How to downgrade to older version of Gradle

2019-01-15 06:35发布

问题:

I have in my .gradle folder, a 2.4 folder wich 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 do not solve and im still with 2.4 version.

How can i solve this?

回答1:

Change your gradle version in project setting: If you are using mac,click File->Project structure,then change gradle version,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'
    }
}


回答2:

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.



回答3:

go to your project gradle file and change the version