离子中的Android项目构建失败

时间:2016-09-27 15:08:00

标签: android cordova ionic-framework dex

每当我尝试在离子中构建我的android项目时,它会给我以下错误:

Dex: The number of method references in a .dex file cannot exceed 64K.

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:484)
    at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:26
    1)
    at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:473)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:50
    4)
    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)

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

尝试使用cordova-multidex-plugin在Cordova应用程序上启用Android多索引。

使用以下命令添加插件:

cordova plugin add https://github.com/solent/cordova-plugin-multidex

您还可以查看此SO post 以获取更多相关信息。