16

With the release of Android Studio 3.0 Beta release, the android studio provides next-generation dex compiler, D8 to compile code and build android APK. Currently, D8 is available for preview.

Check 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?

pRaNaY
  • 24,642
  • 24
  • 96
  • 146

4 Answers4

14

To enable D8 for your Android Studio 3.0 Beta, you can add following line in your project's gradle.properties file:

android.enableD8=true
pRaNaY
  • 24,642
  • 24
  • 96
  • 146
6

If you do not have a gradle.properties file simple create it in your's root project directory (or folder) and add this line:

android.enableD8=true

Nicolas Jafelle
  • 2,661
  • 2
  • 24
  • 30
1

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

To try it, set the following in your project's gradle.properties file:

android.enableR8=true 

R8 also has full mode that is not directly compatible with Proguard. In order to try that out you can additionally set the following in your gradle.properties file:

android.enableR8.fullMode=true

You can check this blog for further details

Dipali Shah
  • 3,742
  • 32
  • 47
0

As others mentioned, you can enable D8 via android.enableD8=true in your gradle.properties but in case you encountered compile error as such "Process 'command 'xxx/bin/java'' finished with non-zero exit value 1" on a project migrated/imported into the new Android Studios 3.1+ , then try with this:

android.enableD8.desugaring=true

This will execute desugaring as part of D8 which speeds up the process.

kevoroid
  • 5,052
  • 5
  • 34
  • 43