真的无语,现在的AS最新版都用gradle7了,老项目还在4呢!!而且连语法结构都改变了,带来了好大的阻碍,这里提供一个最新版AS(花栗鼠)降低gradle并编译成功的方法
外层build.gradle,你可以直接复制粘贴我的,因为新版gradle语法都不一样了,很烦人诶,复制粘贴大法好!!直接用老版写法
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
然后再settings.gradle中删除其他东西只留下这两行
gradle/gradle-wrapper.properties也可以检查一下有没有修改,一般修改File/Project Structure就能自动改变了,没有的话就自己改成对应的Gradle版本号
到此就修改完成啦
build successful!!!!