在我的Cordova应用程序中,我使用的是Crosswalk插件。当我尝试为Android构建时,我收到以下错误:
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexIndexOverflowException: Cannot merge new index 65600 into a non-jumbo instruction!
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: Cannot merge new index 65600 into a non-jumbo instruction!
at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:111)
at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)
at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:74)
at com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)
at com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)
at com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:50)
at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:826)
at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:800)
at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:772)
at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:669)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:523)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
如果我使用像相机和phonegap-plugin-push这样大的插件组合,这似乎就会出现。
我还注意到以下构建消息:
要在进程中运行dex,Gradle守护程序需要更大的堆。它 目前大约有910 MB。为了更快的构建,增加 Gradle守护程序的最大堆大小超过2048 MB。去做 在项目中设置org.gradle.jvmargs = -Xmx2048M gradle.properties。有关更多信息,请参阅 https://docs.gradle.org/current/userguide/build_environment.html