Gradle version 1.10 is required. Current version is 2.0

情到浓时终转凉″ 提交于 2019-11-27 10:50:02
lucas

The version of Android gradle plugin needs to be compatible with the version of Gradle. Checkout the version compatibility mapping table.

Message: "Gradle version 1.10 is required. Current version is 2.0"

Occurs when: Attempting to build an Android project that requires 1.10 version of Gradle while using 2.0 version of it as native.

Solution: Using Gradle Wrapper

Steps:

  1. Make sure the distributionUrl is specified as gradle-1.10-all.zip at the Gradle-wrapper properties file within the Android project. The file path would be like this:

    MyAndroidProject/gradle/wrapper/gradle-wrapper.properties

  2. Run Gradle Wrapper command at the very top level of the project where the executable scripts (i.e. gradlew and gradlew.bat) are located.

    For Unix-like OS:

    ./gradlew wrapper

    For Windows OS:

    gradlew.bat wrapper

  3. Run build command with Gradle Wrapper.

    For Unix-like OS:

    ./gradlew build

    For Windows OS:

    gradlew.bat build

I fix the problem updating the gradle version within build.gradle file:

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

}

This solve my problem. I hope this would help.

Looks like the current version of Android Gradle plugin (0.12.2) works with Gradle of version not later than 1.12.

I haven't found a direct statement for that on the Tools site, there is this phrase only:

Gradle 1.10 or 1.11 or 1.12 with the plugin 0.11.1.

But I manually tested with Gradle 2.0 and 1.2 and it does not work, so I believe this restriction from the Tools site still applies for Android Gradle plugin 0.12.2.

I would suggest to fail back to Gradle 1.12 by setting distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip in your gradle-wrapper.properties file.

Then just use gradlew as usual.

The Android plugin requires a particular version of Gradle. The latest Android plugin version requires 1.12, the Android plugin version declared in your build requires 1.10.

I was following wono's method on mac and I was getting "gradlew command not found" error. Fixed issue by changing mod of gradlew file

chmod +x gradlew

I hope this will help others

If you are getting this problem because you moved project developed using old Android studio to new Android Studio, then just create new project in new Android Studio and cross check your gradle related files with newly create project.

IF ABOVE FIX DO NOT WORK TRY THIS

You have to change this line in build.gradle

classpath 'com.android.tools.build:gradle:0.9.+'

in

classpath 'com.android.tools.build:gradle:1.1.+'

you have to change this line in your build.gradle

buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

In

buildTypes {
        release {
             minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!