我已经为我的android项目添加了第三个lib。当我用蚂蚁打包时,会出现一些错误:
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:593)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:551)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:532)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:169)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:230)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:199)
[dx] at com.android.dx.command.Main.main(Main.java:103)
我已检查过此问题并发现:Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION: 但我的eclipse项目没有build.gradle文件,我该如何解决这个问题呢?
答案 0 :(得分:6)
这可能是由你的app项目和带有android-support-v4 jar的库项目引起的。如果库项目已经将此jar作为依赖项,那么您需要将其从应用程序项目类路径中排除。