2
I need to reverse the version of gradlew
back to 4.10.2. I went to version 5.5.2 to do some testing and need to return to the original version to confirm the test results.
2
I need to reverse the version of gradlew
back to 4.10.2. I went to version 5.5.2 to do some testing and need to return to the original version to confirm the test results.
3
Just type
./gradlew wrapper --gradle-version=<VERSION>
that the gradlew
will configure to use the version described in <VERSION>
. The next time you turn the ./gradlew
, it will download necessary and will stand up correctly:
$ ./gradlew wrapper --gradle-version=4.10.2
> Configure project :app
WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
1 actionable task: 1 executed
$ ./gradlew clean
Downloading https://services.gradle.org/distributions/gradle-4.10.2-bin.zip
..........................................................................
If by chance you switch to an invalid version (such as 5.5.2), the command ./gradlew wrapper --gradle-version=<VERSION>
will be accepted without alerts. However, the next time you execute a command from gradle
, will lead to the following:
$ ./gradlew clean
Downloading https://services.gradle.org/distributions/gradle-5.5.2-bin.zip
Exception in thread "main" java.io.FileNotFoundException: https://downloads.gradle-dn.com/distributions/gradle-5.5.2-bin.zip
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at org.gradle.wrapper.Download.downloadInternal(Download.java:67)
at org.gradle.wrapper.Download.download(Download.java:52)
at org.gradle.wrapper.Install$1.call(Install.java:62)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
Including the version change command!!
To resolve this, change the file in hand ./gradle/wrapper/gradle-wrapper.properties
. For example, mine was like this after inserting the invalid version:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Just change the distributionUrl
to something valid. Normally this file is in the versioning system, so just go back to its previous instance. Otherwise, use a known version (such as 5.5
, 5.5.1
, 4.10.2
...):
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Browser other questions tagged gradle command-line
You are not signed in. Login or sign up in order to post.