Android Studio: “Use default gradle wrapper” versus “Use custom gradle wrapper”

What is the difference between Android Studio Gradle settings:

Android Studio->Preferences->Gradle

Use default gradle wrapper (recommended) and Use customizable gradle wrapper ?

Background:

I am working on an Android project in Android Studio and Gradle wrappers.

However, when I use the Android Studio settings "Use custom gradlew shell" every time members of my team synchronize the Android Studio project with the gui command:

enter image description here

they find the updated date gradle/wrapper/gradle-wrapper.properties (and lead to additional differences in the git repo).

Switching to "Use the default Gradle wrapper" seems to solve this problem.

+51
android android-studio gradle gradlew
Jul 17 '14 at 19:33
source share
1 answer

See IntelliJ IDEA help here :

  • Using the default gradle shell means that gradle controls the version number
  • Using a custom Gradle shell means that IDEA controls the version number of the Gradle shell.

The version number is stored in gradle/wrapper/gradle-wrapper.properties . Therefore, when you select "use a custom Gradle shell" each time you open a project with IDEA, it modifies the properties file to customize the version of the shell specified in the IDEA project.

For the sake of repetitive builds (even on your continuous build server that does not run IDEA), let Gradle control the version number and use the default wrapper for the gradle.

You can set the version number that Gradle uses inside your build.gradle using

 // 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' } 

Note: do not forget that this configuration is used only to create a shell. To activate it, you must do the generation with gradlew wrapper . This task updates gradle-wrapper.properties , which is subsequently used for all shell executions.

+46
Nov 25 '14 at 9:16
source share



All Articles