D8, the Next-Generation Dex Compiler, is Available in Android Studio 3.0 Beta
Google has been working on version 3.0 of Android Studio throughout the year and last week the company released a new update for the development software. At Google I/O earlier this year, the company officially announced Kotlin support for Android Studio and shortly after released an early preview of the IDE. More work has gone into this big update and has now reached a 3.0 beta release that includes D8, a next-generation dex compiler.
Dex compilation is an integral part of the Android application development process. It’s during this process that the compiler transforms .class bytecode into .dex bytecode. This is a requirement for applications to work for the Android Runtime (or Dalvik in the case of older versions of Android). Most of the work here is done under the hood, but it’s this process that impacts how long it takes for your application to build for each new version you want to test.
Build time isn’t the only important factor here when it comes to the dex compiler though. This compiler also determines how big (or small) the .dex file size is, and it can even impact the typical runtime performance for your application. So for the new release of Android Studio that brings its version up to 3.0 beta, Google has worked to improve this dex compiler and is upgrading it from DX (what you’re likely using now) to what they’re calling D8.
As you can see from the images above, the next-generation dex compiler is faster and reduces the file size of .dex files as well. While this new compiler is in the latest update to Android Studio (which can be downloaded here), it’s not enabled by default. Instead, developers will need to set the following code in your project’s gradle.properties file:
android.enableD8=true. Google plans to preview this new dex compiler over the next few months so they can fix any critical bugs discovered by the community before it’s official release.
Expect D8 to be used as the dex compiler in Android Studio 3.1.
Source: Android Developer’s Blog