How to downgrade to older version of Gradle

AndroidAndroid StudioGradle

Android Problem Overview


I have in my .gradle folder, a 2.4 folder which is the version of gradle. I want to downgrade to 2.2.1, because I need to use Gradle plugin 1.0.1. I already try to change by:

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

But this did not solve the issue and I'm still with 2.4 version.

How can I solve this?

Android Solutions


Solution 1 - Android

Change your gradle version in project setting: If you are using mac,click File->Project structure,then change gradle version,here: enter image description here

And check your build.gradle of project,change dependency of gradle,like this:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.1'
    }
}

Solution 2 - Android

I did following steps to downgrade Gradle back to the original version:

  • I deleted content of '.gradle/caches' folder in user home directory (windows).
  • I deleted content of '.gradle' folder in my project root.
  • I checked that Gradle version is properly set in 'Project' option of 'Project Structure' in Android Studio.
  • I selected 'Use default gradle wrapper' option in 'Settings' in Android Studio, just search for gradle key word to find it.

Probably last step is enough as in my case the path to the new Gradle distribution was hardcoded there under 'Gradle home' option.

Solution 3 - Android

Got to

> gradle-wrapper.properties

Change the version of the below mentioned distribution (gradle-5.6.4-bin.zip)

> distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-bin.zip

Solution 4 - Android

got it resolved:

uninstall the entire android studio

uninstalling android with the following commands

rm -Rf /Applications/Android\ Studio.app  
rm -Rf ~/Library/Preferences/AndroidStudio*  
rm -Rf ~/Library/Preferences/com.google.android.*  
rm -Rf ~/Library/Preferences/com.android.*  
rm -Rf ~/Library/Application\ Support/AndroidStudio*  
rm -Rf ~/Library/Logs/AndroidStudio*  
rm -Rf ~/Library/Caches/AndroidStudio*  
rm -Rf ~/.AndroidStudio*  
rm -Rf ~/.gradle  
rm -Rf ~/.android  
rm -Rf ~/Library/Android*  
rm -Rf /usr/local/var/lib/android-sdk/  
rm -Rf /Users/<username>/.tooling/gradle

Remove your project and clone it again and then goto Gradle Scripts and open gradle-wrapper.properties and change the below url which ever version you need

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

Solution 5 - Android

A simple fix is to downgrade android gradle in android/build.gradle. Version 4.1.0 seems to cause problems.

dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

Solution 6 - Android

For me , I was trying to run the Gradle project but some dependencies has compatibility issues so i had to downgrade it to a lower version.

I updated the gradle version in gradle-wrapper.properties with a suitable version.

enter image description here

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
QuestionWitaloBenicioView Question on Stackoverflow
Solution 1 - AndroidstarkshangView Answer on Stackoverflow
Solution 2 - AndroidPotassView Answer on Stackoverflow
Solution 3 - AndroidUdara SeneviratneView Answer on Stackoverflow
Solution 4 - Androidsravan ganjiView Answer on Stackoverflow
Solution 5 - Androiduser10598432View Answer on Stackoverflow
Solution 6 - AndroidSidharth K.BurnwalView Answer on Stackoverflow