How to enable Dex D8 compiler (next-generation Dex compiler) in Android studio

With the release of Android Studio 3.0 beta , android studio provides the next generation dex compiler, D8, for compiling code and building the android APK. D8 is currently available for preview.

Check out more details: https://android-developers.googleblog.com/2017/08/next-generation-dex-compiler-now-in.html

How to enable build using D8 in android studio?

+15
android android-studio build.gradle dex
source share
4 answers

To enable D8 for your beta version of Android Studio 3.0, you can add the following line to your gradle.properties project:

android.enableD8=true 
+14
source share

If you do not have the gradle.properties file, just create it in the project root directory (or folder) and add the following line:

android.enableD8 = true

+5
source share

R8, available for preview as part of Android Studio 3.0 Beta

To try this, set the following in your gradle.properties project:

 android.enableR8=true 

The R8 also has full mode, which is not directly compatible with Proguard. To try this, you can optionally set the following in your gradle.properties file:

 android.enableR8.fullMode=true 

You can check this blog for more information.

+1
source share

As already mentioned, you can enable D8 via android.enableD8=true in your gradle.properties, but in case you encounter a compilation error, because the Process command "xxx / bin / java" exited with a non-zero exit value 1 " project transferred / imported to the new Android Studios 3. 1+, then try this:

android.enableD8.desugaring=true

This will do the de-sagering as part of the D8, which speeds up the process.

0
source share

All Articles