Roberto Tellez Ibarra Roberto Tellez Ibarra - 6 months ago 46
Android Question

What is android multidex?

There are many post about multidex. I experienced sometimes errors solved including

multiDexEnabled true
section of my build.gradle.

But, what is exactly this feature? Which are the scenarios for using it?


Quoting the documentation:

Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable specification limits the total number of methods that can be referenced within a single DEX file to 65,536, including Android framework methods, library methods, and methods in your own code. Getting past this limit requires that you configure your app build process to generate more than one DEX file, known as a multidex configuration.

So, the feature is: it allows your complex app to compile. The scenarios for using it are when your app fails to compile due to hitting the 64K DEX method reference limit. This appears as a build error, such as:

Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536