1

我正在尝试打包一个使用 RoboGuice 的 Android 应用程序。.class 文件编译良好,但在构建 Android 包时,dx 失败并显示“无扩展操作码”消息。

运行dx --dex --debug --verbose target/android-classes产生:

trouble writing output:
com.android.dx.util.DexException: No expanded opcode for 6c80c7f5 Key.java:371@0003: invoke-virtual v0:[Lcom/google/inject/Key$NullAnnotationStrategy;, com.google.inject.Key$NullAnnotationStrategy[].clone:()Ljava/lang/Object;
at com.android.dx.dex.code.OutputFinisher.findExpandedOpcodeForInsn(OutputFinisher.java:526)
at com.android.dx.dex.code.OutputFinisher.calculateReservedCount(OutputFinisher.java:467)
at com.android.dx.dex.code.OutputFinisher.reserveRegisters(OutputFinisher.java:403)
at com.android.dx.dex.code.OutputFinisher.finishProcessingAndGetList(OutputFinisher.java:359)
at com.android.dx.dex.code.DalvCode.finishProcessingIfNecessary(DalvCode.java:108)
at com.android.dx.dex.code.DalvCode.getInsns(DalvCode.java:185)
at com.android.dx.dex.file.CodeItem.place0(CodeItem.java:223)
at com.android.dx.dex.file.OffsettedItem.place(OffsettedItem.java:242)
at com.android.dx.dex.file.MixedItemSection.placeItems(MixedItemSection.java:312)
at com.android.dx.dex.file.DexFile.toDex0(DexFile.java:543)
at com.android.dx.dex.file.DexFile.toDex(DexFile.java:216)
at com.android.dx.command.dexer.Main.writeDex(Main.java:574)
at com.android.dx.command.dexer.Main.run(Main.java:218)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:95)
...while placing CodeItem{com.google.inject.Key$NullAnnotationStrategy.values:()[Lcom/google/inject/Key$NullAnnotationStrategy;}
...while writing section 7

RoboGuice 1.1.2 (Guice 2) 和 RoboGuice 2.0b3 (Guice 3) 会出现这种情况。

在谷歌搜索中,我在 Stack Overflow 上发现了这个先前的问题,这似乎是一个配置错误,但我认为这不是我遇到的问题......帮助!

4

2 回答 2

0

原来这个问题和Dalvik的hard 64k method limit有关;我提交了一份新的错误报告,要求 Android 团队修复糟糕的诊断输出。

于 2012-02-29T11:46:28.177 回答
0

你可以重写 dx 代码,让它支持扩展操作码。希望我的回答能帮到你。

于 2012-04-05T04:12:35.337 回答