Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Minimum supported Gradle version is 4.4" error started today; no code changes

Tags:

android

gradle

Today, multiple developers on my team started seeing this error when they attempt to run any Gradle task.

* Where:
Build file 'C:\dev\src\my_app_name\app\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Minimum supported Gradle version is 4.4. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in C:\dev\src\my_app_name\gradle\wrapper\gradle-wrapper.properties to gradle-4.4-all.zip

Absolutely no code or config changes were made; Gradle builds just suddenly started to fail. Anyone know why this would happen? My best guess is that a plugin with a dependency on a specific version of Gradle auto-updated itself, but I'm not sure how to figure out which one it is. The line number would suggest that it was the com.application.plugin plugin itself.

I am aware that Android Studio updates often require a corresponding upgrade to Gradle, but nobody on my team updated Android Studio. And, according to the Android-Studio-Gradle version compatibility table, Gradle 4.1 should still work fine with Android Studio 3.0.1, which is what I have been running for some time.

We recently started using Kotlin, and I thought that might be part of the problem, but completely removing everything related to Kotlin didn't help.

I have tried deleting the Gradle caches/ directory, running ./gradlew cleanBuildCache, deleting our project's build/ directories, killing Gradle daemons via ./gradlew --stop, and rebooting -- all to no avail.

I also tried upgrading to Gradle 4.4, but that resulted in a "CIRCULAR REFERENCE" NullPointerException error during DexMergerTransform (separate issue), for reasons that are entirely unclear to me. I'd like to be able to force my environment to NOT take on a Gradle 4.4 dependency right now... but I don't know what suddenly triggered this dependency.

like image 930
Mark McClelland Avatar asked Feb 25 '18 06:02

Mark McClelland


People also ask

How do I update gradle in ionic project?

You can also manually update the Gradle plugin and Gradle. To manually update Gradle plugin, edit android/build. gradle file. Change classpath 'com.


1 Answers

The problem turned out to be that we were using a non-specific version of a plugin. When a change was made to the plugin, the new version was downloaded to our dev environments, and it introduced a dependency on a version of Gradle higher than the one we were using.

In our case, this was the culprit:

classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'

Downgrading to version 8.5.1 of the Butterknife plugin eliminated the dependency on Gradle 4.4.

You also have the option of linking to a specific pre-release "nightly" version. However, this is less than ideal, since these bits don't remain available for long, and you might want to download a build and keep it in your local lib. For example:

classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-20180727.012508-40'

like image 184
Mark McClelland Avatar answered Oct 18 '22 05:10

Mark McClelland