[英]How is Multidex support implemented internally?
As far as I understand, the 64K limit in the classical dex file arises since the byte code instruction for invoke allows for a 16bit value for indexing the functions within the dex. 据我了解,经典dex文件中出现了64K的限制,因为用于调用的字节码指令允许16位值来索引dex中的函数。 But with the introduction of Multidex support, I am not sure how the function indexing is handled across different dex files on a byte code level .
但是随着对Multidex支持的引入,我不确定如何在字节代码级别跨不同dex文件处理函数索引。
So far I tried to look on the android developer page, other than "a complex process" which happens during startup not much of technical details are mentioned 到目前为止,我尝试查看android开发人员页面,除了启动过程中发生的“复杂过程”外,并未提及太多技术细节
To support Multidex, your application's main class has to extends the class 为了支持Multidex,您的应用程序的主类必须扩展该类
android.support.multidex.MultiDexApplication
android.support.multidex.MultiDexApplication
also, you need to add the following dependency in your app module's build.gradle: 另外,您需要在应用模块的build.gradle中添加以下依赖项:
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
and set the multiDexEnabled to true 并将multiDexEnabled设置为true
android {
defaultConfig {
...
multiDexEnabled true
}
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.