DexException:无法将新索引65536合并为非巨型指令 [英] DexException: Cannot merge new index 65536 into a non-jumbo instruction

查看:35
本文介绍了DexException:无法将新索引65536合并为非巨型指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某些未知原因,我的应用突然无法从Android Studio构建.

For some unknown reason my app suddenly won't build from Android Studio.

我不断得到

> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /home/martynas/android-sdk/build-tools/19.1.0/dx --dex --num-threads=4 --output
...
...
...
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Cannot merge new index 65536 into a non-jumbo instruction!

虽然从命令行成功构建了相同的应用程序. 我已经检查了方法引用计数,它远低于可怕的64k.

While the same application is built successfully from command line. I've checked method references count and it's way below the dreaded 64k.

我现在正在使用AS 0.8.11.

I'm using AS 0.8.11 now.

推荐答案

尝试在您的project.properties上添加此行

dex.force.jumbo = true

dex.force.jumbo=true

增加dex文件中字符串的限制.您的项目可能会编译.

Which increment the limit for strings in a dex files. And your project will probably compile.

注意:另外,对于巨型设置,仅对单个dex中的方法,64k的另一个限制.如果将来遇到此限制,则需要删除一些依赖项.

Note : Also with jumbo set, the is another limit of 64K only for methods in an single dex. If you get this limit in the future , you will need to remove some dependencies.

更新-Google Play服务6.5(12-08-14)

在6.5版中,Google最终取消了对Google Play服务的捆绑.因此,从现在开始,可以有选择地将这些API编译到您的可执行文件中.

With version 6.5 Google finally unbundled the Google Play Services. So from now on it'll be possible to selectively compile the APIs into your executable.

示例:

compile 'com.google.android.gms:play-services-maps:6.5.+'
compile 'com.google.android.gms:play-services-ads:6.5.+'

对于其他所有单独的Google Play服务API,请在d上的页面上进行检查.android.com.

For all the other individual Google Play Services APIs check this page on d.android.com.

更新(2015年4月21日): https://developer.android.com/tools/building/multidex.html

Update (21-04-2015) : https://developer.android.com/tools/building/multidex.html

这篇关于DexException:无法将新索引65536合并为非巨型指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆