错误:该项目正在使用不受支持的Gradle版本

时间:2018-08-27 00:10:49

标签: android android-studio gradle apk build.gradle

我的gradle版本是Project的gradle包装器属性中的2.2

distributionUrl=https\://services.gradle.org/distributions/gradle-2.2- 
all.zip

build.gradle:

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

构建apk时出现错误

  

该项目正在使用不受支持的Gradle版本。   请在项目的Gradle设置或项目的Gradle包装器(如果适用)中指向受支持的Gradle版本。

1 个答案:

答案 0 :(得分:2)

您可以清楚地看到,您的项目中正在使用非常旧的gradle版本,不再受支持。

确保您的计算机上安装了最新的gradle版本gradle-4.4。另外,请确保您使用的是最新的Android Stdio 3.1.4

完成上述最新设置后,请在项目文件中进行以下更改:

项目build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

项目gradle/gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip