欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android studio 4.0 加载gradle错误

程序员文章站 2022-03-11 15:42:26
...

Android studio 4.0 加载gradle错误
先在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的地址
Android studio 4.0 加载gradle错误
特别感谢https://blog.csdn.net/da_caoyuan/article/details/104343058
群主给了指导