Sunday, May 17, 2015

Speed up Gradle build time by enabling the Gradle Daemon

Gradle is the new build system for Android projects on Android Studio.

The Gradle Daemon is a background process that does the heavy lifting of running builds, then stays alive between builds waiting for the next build. This allows data and code that is likely to be required in the next build to be kept in memory, ready to go. This dramatically improves the performance of subsequent builds. Enabling the Gradle Daemon is an extremely cheap way to decrease build times.https://gradle.org/docs/current/userguide/gradle_daemon.html

To enable Gradle Daemon, create a file "gradle.properties" in Gradle directory:
on Linux
/home/<username>/.gradle/
on Mac
/Users/<username>/.gradle/
on Windows
C:\Users\<username>\.gradle

Add the following lines to the file:
org.gradle.parallel=true
org.gradle.daemon=true

In Android Studio
> File > Settings > Gradle then enable “Offline work”

Restart Android Studio.

reference:
https://extremegtx.wordpress.com/2015/01/08/android-studio-speed-up-studio-and-gradle/
https://plus.google.com/+AndroidDevelopers/posts/ECrb9VQW9XP

No comments: