powder366
powder366

Reputation: 4421

Gradle version and gradle-wrapper.properties

How do I download the latest Gradle version automatically within a Android project? Do I manually change the file gradle/wrapper/gradle-wrapper.properties

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

And change 2.4 to 2.6 and run gradlew? When I create a Android project, why is not 2.6 there from start?

Upvotes: 9

Views: 20855

Answers (3)

L.Petrosyan
L.Petrosyan

Reputation: 440

If you use macOs, in android studio go

  1. Android Studio
  2. Preferences
  3. Build, Execution, Deployment
  4. Gradle, and change use gradle from: specified location
  5. go to users/current_user
  6. press commant+shift+dot (for show hidden files)
  7. go to gradle folder
  8. go to wrapper folder
  9. open

Now gradle install all missing files, Good Luck :)

Upvotes: 0

Geng  Jiawen
Geng Jiawen

Reputation: 9154

You can change it manualy, but I don't recommend it.Because the gradle wrapper version related to gradlew and gradlew.bat, they may need to change too.If your want to upgrade your gradle wrapper, run this in Android Studio Terminal if you using Linux: ./gradlew wrapper --gradle-version 2.10 For Windows, change the command to gradlew wrapper --gradle-version 2.10

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363567

How do I download the latest Gradle version automatically within a Android project? Do I manually change the file gradle/wrapper/gradle-wrapper.properties

Yes.
You have to change the gradle/wrapper/gradle-wrapper.properties

For example:

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

Then, sync the project. Android Studio will download the new version automatically.

And change 2.4 to 2.6 and run gradlew?

First, sync the project.

When I create a Android project, why is not 2.6 there from start?

The new project is based on a template file.
For this reason, currently any new project is with 2.4 version.

You can change the template, but AS will update it with the next updates.

Upvotes: 9

Related Questions