Android studio 下载依赖jar包慢

问题:下载依赖jar包慢

解决:添加国内源

linux:/home/用户名/.gradle

windows:c:\Users\用户名.gradle

macos:/Users/用户名/.gradle

在.gradle文件夹下新建init.gradle文件,写入:

allprojects{
    repositories {
        def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
        all { ArtifactRepository repo ->
            if(repo instanceof MavenArtifactRepository){
                def url = repo.url.toString()
                if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {
                    remove repo
                }
            }
        }
        maven {
            url REPOSITORY_URL
        }
    }
}
posted @ 2020-07-09 19:45  Neroi  阅读(1089)  评论(0编辑  收藏  举报