首先参考了网上的一篇博客
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
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超限