Error "Minimum supported Gradle version is 5.1.1. Current version is 4.4.1" after update android studio

AndroidGradleAndroid Gradle-Plugin

Android Problem Overview


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?

Android Solutions


Solution 1 - Android

You could just edit YOUR_APPLICATION_FOLDER/gradle/wrapper/gradle-wrapper.properties and change the last line to: distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip Android Studio will download necessary library.

Solution 2 - Android

This was my solution.

My_project
  /gradle
  /wrapper
  /gradle-wrapper.properties 

Modify this line with the Gradle 5.1.1

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

Solution 3 - Android

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

Solution 4 - Android

In my case, gradle failed to download the version I specified though I tried all previous solutions.

Apparently, I was opening my project by selecting "MyProject/App" directory. Gradle successfully updated when I opened the same project by selecting the "MyProject" folder.

Solution 5 - Android

  1. Check your full project and find all "Gradle-wrapper.properties" files. If your project has multiple modules then there are chances of having multiple. and set -

> distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip

  1. Gradle sync

  2. If not done then invalidate the cache and restart the project.

  3. Still not working then go to your root directory on Linux and find .gradle folder. Delete it and restart the android studio.

Solution 6 - Android

If you use Ubuntu and all above answers didn't solve your problem try to upgrade gradle on your Ubuntu with this commands from this answer https://askubuntu.com/a/975018/714791

sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt upgrade gradle

It will help I hope

Solution 7 - Android

I resolved by two below steps.

  1. delete gradle folder
  2. check your classpath 'com.android.tools.build:gradle:{$gradleVersion}

My gradleVersion is 3.5.3.

Solution 8 - Android

I solved this by changing the distributionUrl in gradle-wrapper.properties in gradle/wrapper, not gradle.properties

Solution 9 - Android

Maybe it's your gradle environment variable. execute 'gradle -v' Check that the gradle version of the project matches the gradle environment variable version

Solution 10 - Android

those who are still facing issue with Cordova/Ionic, this is due to CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL which is being checked at platforms/android/cordova/lib/builders/GradleBuilder.js

set CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL to desired distributional

for MacOs

export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL = https\://services.gradle.org/distributions/gradle-5.4.1-all.zip

Solution 11 - Android

I think it's very important to mention which IDE you're using and what are the configurations. What made me upset was, I had a setting in gradle-wrapper.properties file which was "ignored" to my mind.

I've found the settings in the IDEA application settings, there: enter image description here

and then selecting:

enter image description here and everything works as expected.

Deleting 'all other' locally cached versions can never be the right solution ;)

Good luck!

Solution 12 - Android

My app is using Cordova v9.0.0

distributionUrl is set at platforms\android\cordova\lib\builders\ProjectBuilder.js

You can set distributionUrl from the command line with

set CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https://services.gradle.org/distributions/gradle-[version]-all.zip"

Replace [version] with your preference

Solution 13 - Android

it solved for me get the flutter SDK directory

this is my flutter Sdk C:\flutter\.pub-cache\hosted\pub.dartlang.org\connectivity_macos-0.1.0+2\android\gradle\wrapper

change gradle-wrapper.properties

Modify this line with the Gradle 5.1.1

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

Solution 14 - Android

I had the same error: Error "Minimum supported Gradle version is 6.1.1. Current version is 5.1.1" but when I opened the gradle.properties and I found this "distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip" which was correct but wasn't working. To solve this, I deleted the ".gradle" file in the explorer, reopened the app and found out the distributionUrl had change to 5.2.2-all.zip in gradle.properties; I then edited to 6.1.1-all.zip and sync and everything worked like a charm. I hope this can help someone else.

Solution 15 - Android

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)

Solution 16 - Android

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

Solution 17 - Android

also, try removing all older/unwanted versions of gradle using: cd usr/local/Cellar/gradle/

Solution 18 - Android

Don't forget to run the gradle wrapper in your project: https://docs.gradle.org/6.4.1/userguide/gradle_wrapper.html#sec:adding_wrapper

Solution 19 - Android

Delete gradle folder from your project directory as well as from the app directory.

restart Adroid studio and resync gradle.

it will solve your problem. If not you might be opened the project yourproject/app. close Android studio and import your project after selecting yourproject. Then resync gradle. This will solve your problem.

Solution 20 - Android

For Windows 10:

Go to C:\Users\<user-name>\.gradle\wrapper\dists and delete everything there. Android studio will download the appropriate version afterwards.

Solution 21 - Android

If anyone is still searching for a solution after trying literally everything, here's what worked for me.

In the .gitlab-ci.yml file, my image: key was outdated and was writing in the script that Gradle was set to 5.1.1 even though everything in my Android Studio was 7.0.2. After talking to the guy who wrote the image script, I just had to increment the version of that.

https://forum.gitlab.com/t/set-specific-version-of-gradle-for-ci-build/41716/4

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTlaloc-ESView Question on Stackoverflow
Solution 1 - AndroidMarkWalczakView Answer on Stackoverflow
Solution 2 - AndroidÁlvaro AgüeroView Answer on Stackoverflow
Solution 3 - AndroidTlaloc-ESView Answer on Stackoverflow
Solution 4 - Androidt.m.View Answer on Stackoverflow
Solution 5 - AndroidParmeshwar CView Answer on Stackoverflow
Solution 6 - AndroidTigran BabajanyanView Answer on Stackoverflow
Solution 7 - AndroidbeokhView Answer on Stackoverflow
Solution 8 - AndroidNailuj29View Answer on Stackoverflow
Solution 9 - Androidsky clowView Answer on Stackoverflow
Solution 10 - AndroidMubasshir PawleView Answer on Stackoverflow
Solution 11 - AndroidcV2View Answer on Stackoverflow
Solution 12 - AndroidWakeelView Answer on Stackoverflow
Solution 13 - AndroidHossein SohanView Answer on Stackoverflow
Solution 14 - AndroidJoel TView Answer on Stackoverflow
Solution 15 - AndroidMahabub KarimView Answer on Stackoverflow
Solution 16 - AndroideliView Answer on Stackoverflow
Solution 17 - AndroidWhiteShadowDaCoderView Answer on Stackoverflow
Solution 18 - AndroidMarc ThomannView Answer on Stackoverflow
Solution 19 - AndroidNikhil DineshView Answer on Stackoverflow
Solution 20 - Androidromin21View Answer on Stackoverflow
Solution 21 - AndroidAndroid DevView Answer on Stackoverflow