2014-08-30

Level Up - Android: Speed up your Gradle build times with one-line!

Whether or not you are using Android Studio, Gradle build times are slow (especially when you don't have continuous automated builds (another discussion)).

Here's one way to improve the speed Gradle commands like `assembleRelease` is to enable the Gradle daemon. I've sped up my release builds by about 20%!



How to
1. Navigate to your `/.gradle/` directory, typically in `C:/Users/username/.gradle/`
2. In that directory, create a new file called `gradle.properties` and copy in the following line:
org.gradle.daemon=true
3. Run Gradle commands as you typically would.


(Thank to Tim Roes for first sharing this awesome tidbit.)


Speed Tests
I performed just six unscientific tests to judge results of the one-liner -- 3 with, and 3 without. All performed in the following order in a short amount of time.

1. Without: 37.898 seconds
2. Without: 33.787 seconds
3. With: 28.63 seconds
4. With: 27.77 seconds
5. Without: 33.605 seconds
6. With: 27.149 seconds

Average without: 35.097 seconds
Average without (without outlier of 37.898): 33.696 seconds
Average with: 27.85 seconds
Speedup: 20.6%
Speedup (without outlier): 17.3%


Feel free to share your results in the comments also. :)


~ Danial Goodwin ~



Post a Comment