Making Gradle builds faster

Optimize your gradle

1. — dry-run

which will make Gradle actually skip the execution of all tasks.

./gradlew :android:assembleDebug --dry-run

2. — profile

./gradlew :android:assembleDebug --dry-run --profile

enable profiling on the Gradle build. Just slap the — profile flag on the Gradle command and you’ll get a nice report saying where the time went. The profile is locate in


The profile shows that the majority of the time goes into configuring the projects:

3. Use configure on demand

There is a straightforward way to reduce that number. We need to make Gradle configure everything on demand rather than eagerly. Luckily for us, it’s just the matter of adding another command line flag: — configure-on-demand.

./gradlew :android:assembleDebug --dry-run --profile --configure-on-demand

4. Make the configuration faster

add the following code to ~/.gradle/

# Use configure on demand
# Use Gradle daemon
# enable parallel builds

Thanks Mr. Oleg Shelajev:


One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.