Android class duplication error when turning on Apache POI

I have a problem with apache poi excel api (xlsx). I am using android studio and I have added poi files to the "libs" folders. For this reason, this error appears (see below). How can i solve this? Could you explain how you identified the problem?

xmlbeans-2.6.0, poi-ooxml-schemas-3.10.1-20140818, poi-ooxml-3.10.1-20140818, poi-3.10.1-20140818, log4j-1.2.13, junit-4.11, dom4j -1.6. 1, commons-logging-1.1, commons-codec-1.5

Thanks!

My build.gradle is as follows (excluding common things) ...

dependencies {compile fileTree (include: ['* .jar'], dir: 'libs')}

android {packagingOptions {exclude 'META-INF / LICENSE' exclude "META-INF / NOTICE" exclude 'META-INF / LICENSE.txt' exclude "META-INF / NOTICE.txt"}}

There are no duplicate entries in my app.iml ...

Error

Error: class org.apache.xmlbeans.xml.stream.Location has already been added to the output. Remove duplicates. a compiler that does not focus on the modern .class file format. Recommended (org.apache.log4j.chainsaw.ControlPanel $ 1), which does not come with the associated EnclosingMethod attribute. This class was probably produced by the solution is to recompile the class from the source using the modern 1 compiler error; interrupt

+6
source share
2 answers

The xmlbeans 2.6 JAR from Maven Central contains several duplicate class entries. In XMLBeans JIRA, the problem opens . Until they publish a new JAR, I think I'm going to unzip the jar, which will overwrite the duplicates, then re-button it and put it in my libs directory.

+1
source

Please note that there are a number of issues when using Apache POI on Android. Duplicating classes in XmlBeans can currently only be avoided by repacking the jar.

There are currently two projects that are trying to solve most of the problems for you, and are repackaging all classes, including any dependencies, into a single jar file to make it easier to deploy. Some shading is also done to avoid javax-namespace problems that Android does not resolve.

The former is currently based on POI 3.12, while the latter can be compiled with newer versions of the POI more easily.

+1
source

Source: https://habr.com/ru/post/975598/


All Articles