In my previous post I described one thing you can easily do to improve the build speed, namely enabling the gradle daemon. In the meantime, things improved quite a bit:
- Gradle 2.4 (at the moment of writing) has better speed
- You can run things in parallel now like other build tools (e.g. make)
- You can use the "configure on demand" feature even though AS complains a bit about it
How do you make it work? Here are the steps:
Using Gradle 2.4
I've enabled gradle 2.4 for my project and I had no negative side-effects so far. I used the following steps:
- If you're using the gradle wrapper, edit the version in your AS project's properties:
Alternatively, you can edit the wrapper properties file by hand (in <project_dir>/gradle/wrapper/gradle-wrapper.properties
). My wrapper file looks like this:
#Wed Apr 29 11:52:05 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
- Alternatively, download and install gradle 2.4 and configure AS to use it:
This works well with the daemon option
In my main build.gradle file, I've got also a wrapper task appended:
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
You can try without, particularly if you're not using the wrapper :)
More Configuration
In addition to the daemon configuration, you can add the parallel and "on demand" options. Now, my global gradle file looks like this:
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
César Ferreira also adds VM tweaks (e.g. higher MaxPermSize). However, I haven't seen any improvement from doing that for my project.
More stuff
If you're just hobby developing, this should be OK for a while. Otherwise, you can look for more at César's tweaks and tips.
Member discussion: