Run embedded DEX code directly from APK

On devices running Android 10 (API level 29) and higher you can tell the platform to run embedded DEX code directly from your app’s APK file. This option can help prevent an attack if an attacker ever managed to tamper with the locally compiled code on the device.

To enable this feature, set the value of the android:useEmbeddedDex attribute to true in the<application> element of your app’s manifest file. You must also build an APK that contains uncompressed DEX code that ART can access directly. Add the following options to your Gradle or Bazel configuration file to build an APK with uncompressed DEX code. For Gradle users, this setting is only necessary for Android Gradle plugin 4.2 and higher.


packagingOptions {
    dex {
        useLegacyPackaging = false


   nocompress_extensions = [“.dex”],