Book Image

Gradle for Android

By : Kevin Pelgrims
Book Image

Gradle for Android

By: Kevin Pelgrims

Overview of this book

Table of Contents (16 chapters)
Gradle for Android
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Speeding up builds


A lot of Android developers that start using Gradle complain about the prolonged compilation time. Builds can take longer than they do with Ant, because Gradle has three phases in the build lifecycle that it goes through every time you execute a task. This makes the whole process very configurable, but also quite slow. Luckily, there are several ways to speed up Gradle builds.

Gradle properties

One way to tweak the speed of a Gradle build is to change some of the default settings. We already mentioned in parallel build execution in Chapter 5, Managing Multimodule Builds, but there are a few more settings that you can adjust.

Just to recap, you can enable parallel builds by setting a property in a gradle.properties file that is placed in the root of a project. All you need to do is add the following line:

org.gradle.parallel=true

Another easy win is to enable the Gradle daemon, which starts a background process when you run a build the first time. Any subsequent builds will...