Android Studio 3.2.1安装问题解决办法

版权声明: https://blog.csdn.net/u010210864/article/details/84066168

由于公司设置代理服务器,导致安卓工程一直停留在gradle中循环,解决办法如下:

修改两个文件,在目录C:\Users\Administrator.20181015CSB\.gradle下:

gradle.properties

init.gradle

其中:

【gradle.properties】内容:

systemProp.http.proxyPort=8080
org.gradle.daemon=true
systemProp.http.proxyUser=代理用户名
org.gradle.parallel=true
systemProp.http.proxyPassword=代理用户密码
org.gradle.jvmargs=-Xmx2048m -XX\:MaxPermSize\=512m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8
systemProp.https.proxyPassword=代理用户密码
systemProp.https.proxyHost=公司代理服务器
org.gradle.configureondemand=true
systemProp.http.nonProxyHosts=localhost,*.xxxxxx.com
systemProp.http.proxyHost=公司代理服务器 eg.proxy.XXXXXXXXX.com
systemProp.https.proxyPort=8080
systemProp.https.nonProxyHosts=localhost,*.xxxxxxxxxx.com
systemProp.https.proxyUser=代理用户名

【init.gradle】内容:

allprojects{
    repositories {
        def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
        def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
        all { ArtifactRepository repo ->
            if(repo instanceof MavenArtifactRepository){
                def url = repo.url.toString()
                if (url.startsWith('https://repo1.maven.org/maven2')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                    remove repo
                }
                if (url.startsWith('https://jcenter.bintray.com/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                    remove repo
                }
            }
        }
        maven {
                url ALIYUN_REPOSITORY_URL
            url ALIYUN_JCENTER_URL
        }
    }
}

猜你喜欢

转载自blog.csdn.net/u010210864/article/details/84066168
今日推荐