Android studio Gradle build speed up
Since the last update (Build from june 25) any changes in the Android studio Gradle is painfully slow. And it also seems to autotrack changes when you edit the file and recompile on keyup.
Each change takes several minutes on my i5.
Any idea how I can speed up my Gradle changes?
Definitely makes a difference: How To… Speed up Gradle build time
Just create a file named gradle.properties
in the following directory:
/home/<username>/.gradle/ (Linux)
/Users/<username>/.gradle/ (Mac)
C:\Users\<username>\.gradle (Windows)
Add this line to the file:
org.gradle.daemon=true
After change this settings my compile time 10 mins reduced to 10 secs.
Step 1:
Settings(ctrl+Alt+S) ->
Build,Execution,Deployment ->
Compiler ->
type "
--offline
" in command-line Options box.
Step 2:
check the “Compile independent modules in parallel” checkbox.
& click Apply -> OK
Step 3: In your gradle.properties file -> Add following lines
org.gradle.jvmargs=-Xmx2048M -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.daemon=true
Update:
If you are using Android studio 2.0 or above try the Instant Run
Settings → Build, Execution, Deployment → Instant Run → Enable Instant Run.
More info about Instant Run - https://developer.android.com/studio/run/index.html#instant-run
I was able to reduce my gradle build from 43 seconds down to 25 seconds on my old core2duo laptop (running linux mint) by adding the following to the gradle.properties file in android studio
org.gradle.parallel=true
org.gradle.daemon=true
source on why the daemon setting makes builds faster: https://www.timroes.de/2013/09/12/speed-up-gradle/
The dev are working on it. Like I posted in this answer the fastest solution right now is to use gradle from the command line and you should switch to binary libs for all modules you do not develop. On g+ there is a discussion with the developers about it.
Following the steps will make it 10 times faster and reduce build time 90%
First create a file named gradle.properties in the following directory:
/home/<username>/.gradle/ (Linux)
/Users/<username>/.gradle/ (Mac)
C:\Users\<username>\.gradle (Windows)
Add this line to the file:
org.gradle.daemon=true
org.gradle.parallel=true
And check this options in Android Studio