Android studio错误代码2意外顶级异常:

时间:2014-08-22 10:48:52

标签: android android-studio error-code

当我尝试将导入Android应用程序编译到我的android工作室时,我遇到了问题。

哪里错了?

错误:任务'执行失败':freshIM:dexDebug'。

  

com.android.ide.common.internal.LoggedErrorException:无法运行命令:       /Users/Manuel/Desktop/Android/android-sdk-macosx/build-tools/19.1.0/dx --dex --num-threads = 4 --output / Users / Manuel / Desktop / Android / android-sdk- macosx / samples / FreshIM2 / freshIM / build / intermediates / dex / debug / Users / Manuel / Desktop / Android / android-sdk-macosx / samples / FreshIM2 / freshIM / build / intermediates / classes / debug / Users / Manuel / Desktop / Android / android-sdk-macosx / samples / FreshIM2 / freshIM / build / intermediates / dependency-cache / debug / Users / Manuel / Desktop / Android / android-sdk-macosx / samples / FreshIM2 / freshIM / build / intermediates / pre- dexed / debug / classes-1ae19b3a0bf802319e9e1b28ae0be5de00ebab02.jar /Users/Manuel/Desktop/Android/android-sdk-macosx/samples/FreshIM2/freshIM/build/intermediates/pre-dexed/debug/classes-538c6f1f64ea511ecd44305c634b96acf323665f.jar/Users/Manuel / Desktop / Android / android-sdk-macosx / samples / FreshIM2 / freshIM / build / intermediates / pre-dexed / debug / classes-e107340d2d8eacb08585848b04409e8a30f816a9.jar / Users / Manuel / Desktop / Android / android-sdk-macosx / samples / FreshIM2 / freshIM /建设/中间体/ pre-dexed / debug / classes-fdf9350bdef43c6dfdaf1b1f8b6b5aaab33daaf3.jar /Users/Manuel/Desktop/Android/android-sdk-macosx/samples/FreshIM2/freshIM/build/intermediates/pre-dexed/debug/sdk-1.0.1- 830f4db143977ad24a452c5380e08f90b9a646a4.jar /Users/Manuel/Desktop/Android/android-sdk-macosx/samples/FreshIM2/freshIM/build/intermediates/pre-dexed/debug/support-v4-19.1.0-421813bd2bfef69f908cede1f937984c36c82fd0.jar     错误代码:       2     输出:       意外的顶级例外情况:       java.lang.IllegalArgumentException:方法ID不在[0,0xffff]中:65536           在com.android.dx.merge.DexMerger $ 6.updateIndex(DexMerger.java:501)           在com.android.dx.merge.DexMerger $ IdMerger.mergeSorted(DexMerger.java:276)           在com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:490)           在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167)           在com.android.dx.merge.DexMerger.merge(DexMerger.java:188)           在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)           在com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)           在com.android.dx.command.dexer.Main.run(Main.java:230)           在com.android.dx.command.dexer.Main.main(Main.java:199)           在com.android.dx.command.Main.main(Main.java:103)

1 个答案:

答案 0 :(得分:2)

每个应用程序只能有65536个方法。

Dalvik VM每个dex文件最多可以有65536个方法

尝试使用此链接解决此问题 http://android-developers.blogspot.co.il/2011/07/custom-class-loading-in-dalvik.html

根据官方博客“大型应用程序可以包含超过64K的方法引用,这是dex文件中支持的最大数量。为了解决这个限制,开发人员可以将程序的一部分划分为多个二级dex文件,并在运行时加载它们。“