Gradle version and gradle-wrapper.properties

16,401

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.

Share:
16,401
powder366
Author by

powder366

Android Enthusiast

Updated on June 19, 2022

Comments

  • powder366
    powder366 almost 2 years

    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?

    • Mobile Team ADR-Flutter
      Mobile Team ADR-Flutter over 8 years
      You have to change it manually.
    • Gabriele Mariotti
      Gabriele Mariotti over 8 years
      When you sync the project, android studio will automatically download the new version of gradle.
    • powder366
      powder366 over 8 years
      Yes but only the 2.4 version not the 2.6 version? Why are they not downloading the latest stable?
    • powder366
      powder366 over 8 years
      I also noticed that the canary Android Studio use 2.4 and download it specifically, not using the wrapper.