• Android Studio Switching to D8 Dexer
  • Originally written by Jeffrey van Gogh
  • Translation from: The Gold Project
  • This article is permalink: github.com/xitu/gold-m…
  • Translator: Starrier
  • Proofreader: Wavezhang

Faster and smarter application compilation has always been a goal of the Android tools team. That’s why we previously announced D8 as the next generation dex compiler. D8 runs faster than the previous compiler, DX, and produces smaller.dex files with equal or better runtime performance.

We recently announced D8 as the default compiler for Android Studio 3.1. If you haven’t tried D8 before, we hope you’re paying attention to the faster, better features of its DEX compiler when switching.

D8 was originally released as an optional feature in Android Studio 3.0. In addition to our own rigorous testing, we’ve now seen it perform well in a wide variety of applications. As a result, we believe D8 will work well for every developer who starts using it in 3.1. However, if you do have a problem, you can temporarily revert to DX by setting your project’s Gradle. properties file:

android.enableD8=false
Copy the code

If you do encounter a situation where you need to disable D8, please contact us!

The next step

Our goal is to make sure everyone can use the DEX compiler quickly and correctly. So, to avoid any of our users risking a fallback, we’re phasing out DX in three phases

The first phase is aimed at preventing premature abandonment of DX. At this stage, DX will continue to be available in Stduio. We will address critical issues, but we will not add new features. This phase will last for at least six months, during which time we will evaluate any errors that were made while developing the D8 to determine if there are regressions that will prevent some users from using the D8 instead of the DX. Phase 1 will not end until the team has addressed all migration laggers. In this window, we’ll focus specifically on the defect tracking system, so if you have any issues, please issue them.

Once we see a six-month window without a significant return from DX to D8, we will move on to phase 2. This phase, which will last a year, is designed to ensure that even complex projects have plenty of time to migrate. At this stage, we’ll keep the DX usable, but we’ll treat it as if it’s completely deprecated; So we’re not fixing anything.

In the third and final phase, DX will be removed from Android Studio. At this point, you will need to use an older version of Android Gradle plugin to continue building with DX.


Diggings translation project is a community for translating quality Internet technical articles from diggings English sharing articles. The content covers the fields of Android, iOS, front end, back end, blockchain, products, design, artificial intelligence and so on. For more high-quality translations, please keep paying attention to The Translation Project, official weibo and zhihu column.