Jeff Brateman
Jeff Brateman

Reputation: 3277

Android Studio gradle-###-bin.zip vs. gradle-###-all.zip

One developer on my team has some setting in Android Studio that replaces the distributionUrl entry in gradle/wrapper/gradle-wrapper.properties to use the gradle-###-all.zip, while my Android Studio changes it back to gradle-###-bin.zip.

Basically, my diff always looks like:

-distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip

This is annoying. What setting is it, and how do I change it?

Upvotes: 77

Views: 15905

Answers (4)

Mark Han
Mark Han

Reputation: 3155

If you and the other developer want a uniform experience, place this code in your build.gradle file

wrapper {
    distributionType = Wrapper.DistributionType.ALL
}

This will make ./gradlew wrapper --gradle-version 5.6 automatically append -all instead of -bin

For build.gradle.kts:

tasks.wrapper {
    distributionType = Wrapper.DistributionType.ALL
}

Like @San said, -all will have binaries, sources, and documentation, while -bin will just have the binaries.

Upvotes: 13

Cristan
Cristan

Reputation: 14135

The difference is that the -bin version contains only the runtime and no sample code and documentation. 1

It actually makes sense to go for the -bin version: it is smaller and you're unlikely to need the -all version unless you're debugging Gradle scripts. For this reason, the lint warning to go for the -all version has been removed. Also, new projects are generated with the -bin version by default.

There is a ticket to let IntelliJ download the sources when you need them (after which there really isn't a reason for the -all version), but it hasn't been implemented yet.

Upvotes: 3

San
San

Reputation: 5697

gradle-1.12-all.zip file will have binaries, sources, and documentation. gradle-1.12-bin.zip will have only binaries(That should be enough as you don't need any samples/docs)

If you want to know about gradle wrapper, please check this http://www.gradle.org/docs/current/userguide/gradle_wrapper.html

Upvotes: 82

niqueco
niqueco

Reputation: 2408

From what I've seen Android Studio recommends to use gradle-*-all.zip and even provides a "quick fix" to change that. On the other hand, the command ./gradlew wrapper sets up the wrapper using gradle-*-bin.zip, overwriting the previous setting. Make sure nobody is calling "./gradlew wrapper" automatically.

Upvotes: 9

Related Questions