当前位置 : 主页 > 手机开发 > android >

什么是Android MultiDex?

来源:互联网 收集:自由互联 发布时间:2021-06-11
关于MultiDex有很多帖子.我有时遇到过错误,包括我在build.gradle的defaultConfig部分中的multiDexEnabled为true. 但是,这个功能到底是什么?使用它的场景是什么? 引用 the documentation: Android appli
关于MultiDex有很多帖子.我有时遇到过错误,包括我在build.gradle的defaultConfig部分中的multiDexEnabled为true.

但是,这个功能到底是什么?使用它的场景是什么?

引用 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.

因此,该功能是:它允许您的复杂应用程序编译.使用它的方案是由于达到64K DEX方法参考限制而导致应用程序无法编译.这显示为构建错误,例如:

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