参考
修改前的依赖
build.gradle 文件
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镜像仓库地址
http://maven.aliyun.com/nexus/content/groups/public/
jentral镜像仓库地址
https://maven.aliyun.com/repository/jcenter
google镜像仓库地址
https://maven.aliyun.com/repository/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'} } }
来源:https://www.cnblogs.com/yangyxd/p/12509639.html