我的应用程序由于类重复而无法编译

时间:2019-05-05 14:09:04

标签: android gradle build

我正在尝试在我的应用中解析一个xlsx文件,所以我在build.gradle中添加了这两个库

implementation 'org.apache.poi:poi:3.17'
implementation 'org.apache.poi:poi-ooxml:3.17'

但是当我尝试编译时,我发现了这些错误

Duplicate class org.apache.xmlbeans.xml.stream.Location found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.ReferenceResolver found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLEvent found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLInputStream found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLName found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLStreamException found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.utils.NestedThrowable found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.utils.NestedThrowable$Util found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)

Go to the documentation to learn how to Fix dependency resolution errors.

我不知道如何发生这种情况,该类似乎没有重复,我试图清理和重建,但是似乎没有发现错误提示的动作。

有帮助吗?

1 个答案:

答案 0 :(得分:0)

转到图书馆,它在我的位置: C: \ Users \ Souln \ .gradle \ caches \ modules-2 \ files-2.1 \ org.apache.xmlbeans \ xmlbeans \ 2.6.0 \ 29e80d2dd51f9dcdef8f9ffaee0d4dc1c9bbfc87;

xmlbeans-2.6.0分发到“ x”文件夹(例如)-拆包时删除重复项;使用存档打开xmlbeans-2.6.0,从此处删除所有内容,然后从此处的文件夹“ x”复制文件。