Android Studio: "Use Default Gradle Wrapper" VS. "Use Customizable Gradle Wrapper"

Android Studio: Use default gradle wrapper vs. Use customizable gradle wrapper

See the IntelliJ IDEA help here:

  • Using the default gradle wrapper means that Gradle controls the version number
  • Using the customizable gradle wrapper means that IDEA controls the version number of the gradle wrapper.

The version number is stored in gradle/wrapper/gradle-wrapper.properties. So when you choose "using the customizable gradle wrapper" each time you are opening the project with IDEA, it will change the property file to adjust the wrapper version you specified in the IDEA project.

For the sake of repeatable builds (even on your continuous build server which doesn't run IDEA) let Gradle control the version number and use the default gradle wrapper.

You can set the version number which is used by Gradle inside your build.gradle with

// needs at least Gradle V1.7
wrapper {
gradleVersion = '2.2.1'
}

or

// works with every Gradle version
task wrapper(type: Wrapper) {
gradleVersion = '2.2.1'
}

Remark: don't forget that this configuration is only used for the generation of the wrapper. To activate it, you have to execute the generation with gradlew wrapper. This tasks updates the gradle-wrapper.properties which is used afterwards for all wrapper executions.

android studio Use gradle wrapper grayed out

1) Create a new simple project with Android Studio.

2) Find the gradle folder in the new project.

3) Use the export option in eclipse to create the build.gradle script. (Requires at least adt version 22.0)

4) Copy the gradle folder into the project you want to export to Android Studio.

5) Now try to import this project, u shall be able to select the wrapper check box.

This may resolve the problem you asked for, you can also set the Gradle home path and use the other option just fine.

Hope this helps!

Android Studio on Mac - Use default gradle wrapper

If it can help someone in the future:

The right path is

not

Settings → Build, Execution, Deployment → Build Tools → Gradle,

but

Preferences → Build, Execution, Deployment → Build Tools → Gradle

How to change the version of the 'default gradle wrapper' in IntelliJ IDEA?

The easiest way is to execute the following command from the command line (see Upgrading the Gradle Wrapper in documentation):

./gradlew wrapper --gradle-version 5.5

Moreover, you can use --distribution-type parameter with either bin or all value to choose a distribution type. Use all distribution type to avoid a hint from IntelliJ IDEA or Android Studio that will offer you to download Gradle with sources:

./gradlew wrapper --gradle-version 5.5 --distribution-type all

Or you can create a custom wrapper task

task wrapper(type: Wrapper) {
gradleVersion = '5.5'
}

and run ./gradlew wrapper.

i got this error: Warning:Gradle version 2.10 is required

Go to File > Settings > Build, Execution, Deployment > Build Tools > Gradle.
Choose Use default gradle wrapper



Related Topics



Leave a reply



Submit