HomeAndroidAndroid Next-generation Dex Compiler Now in Preview

Android Next-generation Dex Compiler Now in Preview

If you are an android developer then you know that dex compilation is a key step in building an APK. This is the process of transforming .class bytecode into .dex bytecode for the Android Runtime (or Dalvik, for older versions of Android). The dex compiler mostly works under the hood in your day-to-day app development, but it directly impacts your app’s build time, .dex file size, and runtime performance.

The team of Android developers at Google are investing in making some great and important improvements in the dex compiler. In the recent announcement, the team has announced the next-generation dex compiler, D8. This new dex compiler is now available for preview as part of Android Studio 3.0 Beta release.

When comparing with the current DX compiler, D8 compiles faster and outputs smaller .dex files, while having the same or better app runtime performance.

Courtesy: Android Developers Blog
Courtesy: Android Developers Blog

How to try it?

D8 compiler is available for your preview starting with Android Studio 3.0 Beta. To try it, set the following in your project’s gradle.properties file:


What’s next?

The android developers team is planning to bring D8 out of preview and enable it as the default dex compiler with the release of Android Studio 3.1. At that time, the DX compiler will officially be put in maintenance mode. Only critical issues with DX will be fixed moving forward.

Beyond D8, the team is also working on R8, which is a Proguard replacement for whole program minification and optimization. While the R8 project has already been open sourced, it has not yet been integrated with the Android Gradle plugin.



Most Popular