dex超限的解决办法

首先参考了网上的一篇博客


http://blog.csdn.net/maxwell_nc/article/details/51050700


博客中讲到有两种解决方式,一个是jumbomode=true,一个是用官方的multidex包


但是这两种哪个更好呢?后来我在网上查资料,如下

https://developers.soundcloud.com/blog/congratulations-you-have-a-lot-of-code-remedying-androids-method-limit-part-1 

https://stackoverflow.com/questions/30495212/android-jumbo-mode-vs-multidex 

资料中写道
To address a common point of confusion, the method limit described above is unrelated to “jumbo mode”, but it has a similar cause. Jumbo mode pertains to the number of strings that can be referenced in a DEX file, which by default are indexed using 16 bit wide integers. Therefore, if your application encodes more than 2^16 strings, the dx tool will fail as well. For string references however, there is a remedy: DEX supports “jumbo opcodes” which allow for 32 bit wide string references. The jumboMode flag in an Android Gradle build script enables this mode, allowing up to 2^32 strings to be referenced. However no equivalent switch exists for method references, so jumbo mode does nothing for you when your DEX file exceeds the number of methods allowed.

大致意思是 jumbomode修改的是dex中string类型的上限,并不会修改dex方法的上限

至此算是明白了两种方式的差别。

做此记录,欢迎指正
---------------------------------
附:multidex包不仅可以解决方法超限,也可以解决string超限


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值