先在build.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/repository/public’ }
maven { url ‘https://maven.aliyun.com/repository/google’ }
maven { url ‘https://maven.aliyun.com/repository/jcenter’ }
google()
jcenter()
}
dependencies {
classpath “com.android.tools.build:gradle:4.0.1”
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
/lintOptions {
// true 所有正式版构建执行规则生成崩溃的lint检查,如果有崩溃问题将停止构建
checkReleaseBuilds false
//true 错误发生后停止构建
abortOnError false
}/
allprojects {
repositories {
maven { url ‘https://maven.aliyun.com/repository/public’ }
maven { url ‘https://maven.aliyun.com/repository/google’ }
maven { url ‘https://maven.aliyun.com/repository/jcenter’ }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
如果还是报错可以尝试更改setting中更改gradle的地址
这个地址是C:\Users\你自己的用户名.gradle\wrapper\dists\gradle-6.6.1-all\gradle-6.6.1
可以下载一个gradle-6.6.1-all然后添加进去
特别感谢https://blog.csdn.net/da_caoyuan/article/details/104343058
群主给了指导