What exactly is the difference between Android Studio's Gradle options:
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 using a Gradle wrapper.
However, when I use the Android Studio settings "Use customizable gradlew wrapper" every time my team members sync the Android Studio project using the gui command:
they find the gradle/wrapper/gradle-wrapper.properties
date being updated (and resulting in a extra diffs on the git repo).
Switching to "Use default gradle wrapper" seems to solve this issue.
As per my knowledge, "default gradle" is the one that is packaged with the project. This is done so everyone in the team uses the same version. Local gradle is the one you have on your system.
you don't need to have Gradle installed on your machine to build the project. the wrapper guarantees you'll be using the version of Gradle required by the project. you can easily update the project to a newer version of Gradle, and push those changes to version control so other team members use the newer version.
From Gradle's documentation:The scripts generated by this task are intended to be committed to your version control system. This task also generates a small gradle-wrapper. jar bootstrap JAR file and properties file which should also be committed to your VCS.
Gradle is commonly used by developers to manage their project's build lifecycle. It's the default choice of build tool for all new Android projects. In this tutorial, we'll learn about Gradle Wrapper, an accompanying utility that makes it easier to distribute projects.
See the IntelliJ IDEA help here:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With