参考
修改前的依赖
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
上面的这种方式,由于会用到google的maven仓库,直接导致相关的依赖库无法下载,gradle plug3.0无法下载的问题。
用阿里云仓库解决问题
mavenCentral镜像仓库地址
jentral镜像仓库地址
google镜像仓库地址
完整模式
buildscript {
repositories {
// mavenCentral()
// jcenter()
// google()
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
// mavenCentral()
// jcenter()
// google()
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'https://maven.aliyun.com/repository/jcenter'}
}
}