有時 as 載入庫時特別慢,有時還失敗。
我們可以用阿里云代理。
在電腦目錄:C:\Users\用戶名.gradle 目錄下,創(chuàng)建 init.gradle.txt 文件。
輸入:
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/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
remove repo
}
}
}
maven {
url REPOSITORY_URL
}
}
}
這時就可以用阿里云代理 下載了。