Gradle thinks 2.10 is less than 2.2 when resolving plugins

I have an Android Studio project and upgraded the gradle-wrapper to use 2.10.

I now get the following error:

A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /Users/brindy/Projects/TestApp/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip

Using 2.9 works fine.

Same thing happens if I don’t use the gradle-wrapper: 2.10 gives the above error, 2.9 works fine.

Was previously using 2.7.

Thanks in advance.

1 Like

This is coming out of the Android Gradle plugin, they only accept 2.2 - 2.9:

https://android.googlesource.com/platform/tools/base/+/master/build-system/gradle/src/main/groovy/com/android/build/gradle/BasePlugin.java#113

There’s a com.android.build.gradle.overrideVersionCheck system property you can set to override that check. A change would need to be made to the Android plugin to accept 2.10+.

1 Like

Actually, nevermind. Seems like someone fixed it:
https://android.googlesource.com/platform/tools/base/+/b96ce169b385d006cfccc4c9f1e54ab47140f59d

I think there’s a newer Android Gradle plugin release that contains that fix (I think 1.5.x)

1 Like

As new release with the fix not available yet, the former walk-around works fine.

buildscript {
System.properties[‘com.android.build.gradle.overrideVersionCheck’] = ‘true’

}

3 Likes

Yes this work around worked for me for the time being.

Use ‘./gradlew’ instead of ‘gradle’ to resolve this issue.

Use ‘./gradlew’ instead of ‘gradle’ to resolve this issue.