Android – More Speed up Building with Gradle

Posted by in Software

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/ My wrapper file looks like this:

  • 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:

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:

César Ferreira also adds VM tweaks (e.g. higher MaxPermSize). However, I haven’t seen any improvement from doing that for my project.

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.

A little experiment: If you find this post and ad below useful, please check the ad out 🙂