Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3 - Override Gradle Version

I'm setting up my app to migrate to Android Studio 3, but I'm running into some issues with the gradle version.

The docs say to upgrade to at least Gradle 4.0-milestone-1 but I want to keep these migration changes on a separate branch until it's stable. That way I can use AS 3.0, and if something doesn't work I can quickly switch back to using 2.3.

The problem is that I can't find any way to override the gradle version in gradle-wrapper.properties so that for AS 3.0 it'll use 4.0-milestone-2 and for AS 2.3 it'll use 3.X.

Anyone have any ideas on how I can do that?

like image 764
Eliezer Avatar asked Mar 11 '26 20:03

Eliezer


1 Answers

The file you want is called gradle-wrapper.properties not gradle-version.properties. You will find this script in the Gradle Scripts branch in Android Studio (in the Android view).

Update gradle-wrapper.properties

In this file, change the line distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

to read distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-rc-2-all.zip

This will change Gradle-wrapper to use Gradle 4.0-rc-2 rather than 3.5 (obviously, replace the version numbers with the versions you use/want).

When you build your app with ./gradlew assembleRelease it should now use whatever version you configured in gradle-wrapper.properties.

like image 172
Codewild Avatar answered Mar 13 '26 10:03

Codewild



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!