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

查看:23
本文介绍了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.

注意:对于巨型集,另一个限制是 64K,仅适用于单个 dex 中的方法.如果以后遇到这个限制,就需要去掉一些依赖.

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,请查看此 页面.android.com.

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

更新(21-04-2015):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天全站免登陆