我正在使用命令 ant clean debug emma install test 从命令行使用Apache Ant构建我的Android项目,一切运行正常(测试工作和构建成功)。虽然Jenkins构建的相同命令(ANT,JAVA,ANDROID_SDK已配置)在最后的构建步骤中引发错误:
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] Result compacted from 9251,1KiB to 7638,5KiB to save 1612,5KiB
[dx] Merged dex A (5330 defs/5673,8KiB) with dex B (2032 defs/1984,5KiB). Result is 7362 defs/7638,5KiB. Took 0,6s
[dx] com.android.dex.DexException: Multiple dex files define Lcom/vladium/app/IAppVersion;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:246)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:215)
[dx] at com.android.dx.command.Main.main(Main.java:106)
BUILD FAILED
/SDK/android-sdk-macosx/tools/ant/build.xml:892: The following error occurred while executing this line:
/SDK/android-sdk-macosx/tools/ant/build.xml:894: The following error occurred while executing this line:
/SDK/android-sdk-macosx/tools/ant/build.xml:899: The following error occurred while executing this line:
/SDK/android-sdk-macosx/tools/ant/build.xml:283: null returned: 2
Jenkins托管在我的本地机器上(从命令行完美地构建了这个项目),我很困惑,为什么会出现这个错误。使用emma.jar看起来很麻烦,但我无法找到,如何修复Jenkins中的建筑项目。
有什么想法吗?
答案 0 :(得分:0)
找到解决方案。我们必须执行命令(字的顺序非常重要):
ant clean emma debug install test
并从我们的类路径(libs文件夹)中排除任何emma库。一切都很简单。