
将build.gradle檔案内的google()和jcenter()全部注釋掉,換成阿裡雲的,重新開機Android studio,等待一會下載下傳相關檔案,就可以完成gradle了
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven{ url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
// google()
// jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven{ url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
// google()
// jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}