Faster Android Studio Builds with Dex In Process

An Android Tool Time Protip

Reto Meier
May 12, 2016 · 2 min read

Android Studio 2.1 enables a new feature: Dex In Process, that can dramatically increase the speed of full clean builds as well as improving Instant Run performance.

To take advantage of Dex In Process, you’ll need to modify your gradle.properties file and increase the amount of memory allocated to the Gradle Daemon VM by 1 Gb, to a minimum of 2 Gb, using the org.gradle.jvmargs property:

org.gradle.jvmargs=-Xmx2048m
Image for post
Image for post
Increase the Gradle Daemon JVM memory allocation to at least 2 gigabytes

The default Gradle Daemon VM memory allocation is 1 gigabyte — which is insufficient to support dexInProcess, so to take advantage you’ll need to set it to at least 2 gigabytes.

Dex in process works by allowing multiple DEX processes to run within a single VM that’s also shared with Gradle, which is why you need to allocate the extra memory before it can be enabled — that memory will be shared between Gradle and multiple DEX processes.

If you’ve increased the javaMaxHeapSize in your module-level build.gradle file beyond the default of 1 gigabyte, you’ll need increase the memory assigned to the Gradle Daemon correspondingly.

Image for post
Image for post
Graph numbers provided here are from an entirely unscientific experiment based on my own experience doing a clean build of the app on my personal workstation. Your experience will almost certainly vary based on different hardware and projects.

When there’s enough memory assigned Dex in Process is enabled by default, improving overall build performance and removing the overhead of starting multiple parallel VM instances. The result is a significant improvement in all build times, including Instant Run, incremental, and full builds.

The best values values vary based on different hardware, so upgrade to Android Studio 2.1, and experiment with your jvmargs value to see what works best for you.


There are hundreds of tips and tricks to make your Android Studio experience faster and more productive. Subscribe to , and tune in to for more Android Tool Time Pro Tips.

Google Developers

Engineering and technology articles for developers, written…

Reto Meier

Written by

Developer Advocate @ Google, software engineer, and author of “Professional Android” series from Wrox. All opinions are my own.

Google Developers

Engineering and technology articles for developers, written and curated by Googlers. The views expressed are those of the authors and don't necessarily reflect those of Google.

Reto Meier

Written by

Developer Advocate @ Google, software engineer, and author of “Professional Android” series from Wrox. All opinions are my own.

Google Developers

Engineering and technology articles for developers, written and curated by Googlers. The views expressed are those of the authors and don't necessarily reflect those of Google.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store