一般项目默认生成的配置
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
由于google的原因,可能会下载慢甚至下载失败等各种问题。
好在阿里云有提供国内镜像,直接换国内,流畅得很。
最后更换的代码
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
// google()
// jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
// google()
// jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}