意外的顶级异常

时间:2015-06-28 14:23:09

标签: java android gradle

在我的gradle文件中,我目前有以下内容:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile files('libs/itextg-5.5.4.jar')
}

通过上述操作,一切都正常运行。当我添加行compile 'com.itextpdf.tool:xmlworker:5.4.0'时,我收到以下错误:

com.android.dex.DexException: Multiple dex files define Lcom/itextpdf/awt/geom/AffineTransform;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

我该如何解决?

1 个答案:

答案 0 :(得分:1)

该异常意味着有多个依赖项/库定义com/itextpdf/awt/geom/AffineTransform类。

确保您没有重复的依赖项。