切換到國內的Maven鏡像倉庫。
修改項目根目錄下 build.gradle 文件,將 jcenter() 或者 mavenCentral() 替換掉即可。可以用國內的倉庫代替:
阿里的倉庫地址:http://maven.aliyun.com/nexus/content/groups/public/
OSChina的倉庫地址:http://maven.oschina.net/content/groups/public/
buildscript {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/central/'}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}