【问题标题】:POI : duplicate entry: org/apache/xmlbeans/xml/stream/Location.classPOI:重复条目:org/apache/xmlbeans/xml/stream/Location.class
【发布时间】:2016-02-19 07:21:10
【问题描述】:

Android POI 集成。我做了很多搜索,但没有找到解决方案。

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class

我的毕业典礼

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'

compile 'com.google.code.gson:gson:2.4'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.rey5137:material:1.2.2'
compile('com.github.afollestad.material-dialogs:core:0.8.5.4@aar') {
    transitive = true
}
compile('com.mikepenz:materialdrawer:5.0.0@aar') {
    transitive = true
}
compile 'com.pnikosis:materialish-progress:1.5'
compile 'org.apache.poi:poi-ooxml:3.13'

我发现了这个 https://github.com/sbt/sbt-proguard/issues/9

There is no solution here.

There is no solution here.

There is no solution here.

我没有使用任何其他 apache lib。并且没有使用谷歌播放服务。仍然存在同样的问题。

【问题讨论】:

    标签: android apache-poi


    【解决方案1】:

    有一些关于如何让 POI 在 Android 上运行的讨论,请参阅例如http://blog.kondratev.pro/2015/08/reading-xlsx-on-android-4-and-hopefully.html

    打击具体说明

    [...] 但是它不会直接工作,因为 maven 中的 xmlbeans jar 有缺陷并且包含重复的类,[...] 只需准备一次 jar 并将它们放入 libs 目录(如上所述)

    因此您可能需要做一些事情才能使其正常工作,或者您可以使用重新打包的项目https://github.com/andruhon/android5xlsx

    【讨论】:

    • 不是multi dex的问题……是class文件的重复。我已经用过multi dex应用了
    • 正如博客所述,通常下载的 xmlbeans-jar 包含在 Android 上失败的重复类,因此您可以手动删除这些重复项或使用其中之一提供的重新打包的类github项目
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-18
    相关资源
    最近更新 更多