Android:Apache POI 重复条目:org/apache/xmlbeans/xml/stream/Location.class 错误 [英] Android : Apache POI duplicate entry: org/apache/xmlbeans/xml/stream/Location.class error

查看:46
本文介绍了Android:Apache POI 重复条目:org/apache/xmlbeans/xml/stream/Location.class 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行我的 android 项目时遇到以下错误:

Hi I am getting following error while running my android project :

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

我在互联网上搜索过这个问题,提供了以下几种不同类型的解决方案:

I have searched about this issue on internet, differenet type of solutions provided few of them as below :

1] Enable multidex, (by doing `multiDexEnabled true`),
2] Remove support library v4 as v7 comes with it, (I am using only v7),
3] Increase jvm heap size through gradle or through gradle.properties,
2] Do not use multiple playstore library versions (Which I am not using already)

当我在 gradle 中为 Apache POI 添加依赖项时,上述所有内容都开始了:

All above started when I added dependecy for Apache POI in gradle as follows :

dependencies {
    ....
    compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.14'
}

以上在我的情况下都不起作用.为什么会发生这种情况&什么是可靠的解决方案.

None of the above worked in my case. Why this is happening & what is reliable solution.

推荐答案

有几个项目可以尝试解决在 Android 上使用 POI 时出现的许多问题.

There are a few projects available which try to work around a number of issues when using POI on Android.

请看示例项目https://github.com/centic9/poi-on-android/ 允许在 Android 上为 POI 构建单个 jar 文件.它删除了重复项并修复了其他一些与禁止的包名称和其他相关的问题.

Please take a look at the sample project https://github.com/centic9/poi-on-android/ which allows to build a single jar-file for POI on Android. It removes the duplicates and also fixes a few other issues with prohibited package names and others.

该领域的另一个项目是 https://github.com/andruhon/android5xlsx,但是它目前仅支持旧版本的 POI.

Another project in that area is https://github.com/andruhon/android5xlsx, however it only supports an older version of POI currently.

这篇关于Android:Apache POI 重复条目:org/apache/xmlbeans/xml/stream/Location.class 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆