Error “Minimum supported Gradle version is 5.1.1.

2019-07-11 03:23发布

问题:

I updated android studio from 3.3 to 3.4 version and after install and do ./gradlew lint I am getting the next error:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.

Then I use the next command to get more details:

  ./gradlwe build --warning-mode=all

And I get the next message:

Failed to apply plugin [id 'com.android.application']

Minimum supported Gradle version is 5.1.1. Current version is 4.4.1. If using the gradle wrapper, try editing the distributionUrl in .gradle/daemon/4.4.1/gradle/wrapper/gradle-wrapper.properties to gradle-5.1.1-all.zip

And when I edited my gradle-wrapper.properties, I see that the changes were already done, I.E. the version of the distributionUrl already was gradle-5.1.1.-all.zip

Any idea that how can resolve this?

回答1:

Try to download manually Gradle-5.1.1 from https://gradle.org/releases then go to file/project structure/project and put the new version in gradle version. (You can also use this link - jenv.io/candidate/gradle)



回答2:

Finally, I was finally able to solve this dropping the folders of the oldest version in ~/.gradle/wrapper/dists and leave only the gradle-5.1.1-all



回答3:

I was having the same problem after migrating from android.support library to androidx where junit library start with androidTestImplementation and not testImplementation.

So i changed

testImplementation "junit:junit:$rootProject.junitVersion"

to

androidTestImplementation androidx.test.ext:junit:1.0.0-beta01

or

androidTestImplementation "junit:junit:$rootProject.junitVersion"


Remember to append android before testImplementation