5

If you build an Android app using Android Studio's Run button, it will download the necessary gradle tool from the URL in gradle-wrapper.properties and build it. For example, Android Studio will download the 87 MB zip file: https://services.gradle.org/distributions/gradle-3.3-all.zip and unzip it to a location like:

~/.gradle/wrapper/dists/gradle-3.3-all/123abc (271 MB folder)

But if you then rebuild the same app on the command line, using ./gradlew assembleDebug, the command-line gradle will re-download the same 87 MB zip file and unzip it to a new location like:

~/.gradle/wrapper/dists/gradle-3.3-all/456def (duplicate 271 MB folder)

This is slow and inefficient on disk space, as both folders contain exactly the same items. This also happens when using any gradle task on the command-line, like ./gradlew --stop.

  • Why can't they both use the first downloaded tool?

  • Is there a way to prevent this duplicate download?

Similar/related issues:

Mr-IDE
  • 7,051
  • 1
  • 53
  • 59

0 Answers0