Android编译遇到-Unable to execute dex: Cannot merge new index 65761 into a non-jumbo instruction!

来源:互联网 发布:知柏地黄丸方歌 编辑:程序博客网 时间:2024/06/06 02:55

Android编译遇到-Unable to execute dex: Cannot merge new index 65761 into a non-jumbo instruction!错误
当APP功能越来越庞大,代码以及方法会越来越多,早期的Dalvik VM内部使用short类型变量来标识方法的id,最大值限制在65535;综合上述因素,代码在安装的时候,不能通过验证,所以安装失败。
最新的Android可能已经解决了这个问题。也就是64k问题

参考:https://code.google.com/p/android/issues/detail?id=40409

While the Dalvik team works on a fix, I’m going to allow disabling of the new dex merger features. Builds will be slower (actually back like they were before) but they’ll work at least. We were looking at a 21.0.1 release so I’m going to do this now and make sure this gets in.

修改project.properties,添加一行:dex.disable.merger=true 可以解决
在project.properties文件中添加下面两个选项也是可以的:
manifestmerger.enabled=true
dex.force.jumbo=true
此方案适合eclipse编译 android studio配置网上有其他解决方法

0 0