问题描述
我在运行我的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
我已经在Internet上搜索了此问题,其中不同的解决方案类型很少,如下所示:
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添加dependecy时,上述一切就开始了:
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错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!