且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android是什么multidex?

更新时间:2023-11-17 18:57:22

Android应用(APK)文件包含在可执行的Dalvik(DEX)文件形式的可执行字节code文件,其中包含编译code用于运行应用程序。在Dalvik可执行的规范限制了可以在单个文件DEX内引用65,536,包括Android框架方法,库方法,并在自己的code方式方法的总数。获得过去此限制,您需要配置您的应用程序的构建过程,生成多个文件DEX,被称为multidex配置。

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.

所以,特点是:它可以让​​您的复杂应用程序进行编译。使用它的场景是,当你的应用程序编译失败,由于撞击64K DEX方法参考限值。这似乎是一个生成错误,如:

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