关于出了什么问题的任何想法?我正在使用Libgdx
> Error:Execution failed for task ':android:dexDebug'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\Steven\AppData\Local\Android\sdk\build-tools\build-tools-20.0.0\dx.bat
--dex --no-optimize --output
错误代码: 2 输出:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:501)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:276)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:490)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:167)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
>
答案 0 :(得分:0)
您遇到了着名的多dexing问题,其中单个Dex文件无法声明超过65536个方法。这已经在Android构建工具的最新版本中得到解决,您所要做的就是使您的应用程序引用MultiDexApplication
并添加:
android {
defaultConfig {
...
multiDexEnabled = true
}
}
到你的构建脚本。官方文档中有关于此问题的更多详细信息。请参阅Building Apps with Over 65K Methods。