Ben Groot Ben Groot - 6 months ago 201
Android Question

How to speed up Android Studio compilation process

Latest update:
Check out Android Studio 2.0 (preview) Instant Run it is awesome!!!!

I have found some tips (Building and running app via Gradle and Android Studio is slower than via Eclipse) to speed up the compilation process of Android Studio (Gradle) but I still think it is way too slow. It takes about 15 seconds to compile the project and run on the device.

The gradle.properties is already set to:


org.gradle.daemon=true

org.gradle.parallel=true


Edit:
Awesome!!! Colleague of me reported that Jack and Jill might be the solution:
http://www.infoworld.com/article/2856113/mobile-technology/androids-new-jack-and-jill-compilers-head-uphill-to-developers.html I'm reading into it.

Checkout this explanation:
https://www.saikoa.com/blog/the_upcoming_jack_and_jill_compilers_in_android

Edit 2:
New info on Jack and Jill!:
http://tools.android.com/tech-docs/jackandjill

Edit 3:
Android Studio 2.0 seems to release us from all the burden! Check out "Instant Run".
http://android-developers.blogspot.nl/2015/11/android-studio-20-preview.html

Answer

The best to improve Gradle is configure this in your local.properties file

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx3072m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true

With this configuration build time is often reduced from 2-3 minutes to 30 seconds or less. The most important part is the configureondemand attribute.

Edit: Set 3 gigas of memory required by the new option included in Android Studio 2.2 dexing-in-process

Comments