解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
来源:互联网 发布:合肥高铁枢纽 知乎 编辑:程序博客网 时间:2024/05/21 10:41
同时在工程中引入了多个第三方jar包,导致调用的方法数超过了android设定的65536个(DEX 64K problem),进而导致dex无法生成,也就无法生成APK文件。
解决办法如下:
1、谷歌官方已经给出了相关的文档,参照网上搜索的资料,首先,我的问题是:
Error:Execution failed for task ':duchazhushou:dexRelease'.> com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\jeff\AppData\Local\Android\sdk\android-sdk\build-tools\21.1.1\dx.bat --dex --output D:\dev\android\Duchazhushou_TDT\duchazhushou\build\intermediates\dex\release --input-list=D:\dev\android\Duchazhushou_TDT\duchazhushou\build\intermediates\tmp\dex\release\inputList.txtError Code: 2Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502) at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277) at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302) at com.android.dx.command.dexer.Main.run(Main.java:245) at com.android.dx.command.dexer.Main.main(Main.java:214) at com.android.dx.command.Main.main(Main.java:106)
2、在项目的build.gradle文件的dependencies 节中添加分包设置:
dependencies { ... compile 'com.android.support:multidex:' ... }
3、通过在defaultConfig节中设置multiDexEnabled标签为true,开启multi-dexing支持.
defaultConfig { ... multiDexEnabled true ... }
4、分三种情况,由于我并未创建自己的Application.class,直接在AndroidManifest.xml文件的Application声明中添加;
android:name="android.support.multidex.MultiDexApplication"
5、重新build,生成签名APK,安装使用正常。
以上步骤均参考下面链接操作,关于第4步的另外两种情况,在下面链接中均有详细说明:
http://stackoverflow.com/questions/27377080/after-update-of-as-to-1-0-getting-method-id-not-in-0-0xffff-65536-error-i
0 0
- Android 解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
- Android解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
- 解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
- 解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
- 解决com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Android学习笔记----解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
- Android学习笔记----解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
- Android Studio 错误 com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Android Studio 错误 com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Android Studio 错误 com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Android Studio——com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Android Studio 错误 com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Android studio打包错误com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- (转)Android Studio 错误 com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- 关于com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536的解决方法
- “com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题解决
- 异常com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- 错误ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
- Fast Arrangement-3577-线段树成段更新
- KMP算法的next、next value数组代码实现及POJ3461
- Win8.1以及win10以上系统 安装msi文件方法
- Magento SOAP API V2 开放接口修改订单状态
- SQL优化基础 使用索引(一个小例子)
- 解决“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536”问题
- 多项式求和
- 人民币贬值三重冲击波
- hdu5372 Segment Game 树状数组
- 猴子吃香蕉
- HTTP协议详解
- [Win32]打开文件/保存文件/选择文件夹对话框
- NYOJ 469 擅长排序的小明
- 智能设备是如何连接云的