Summary: | Xml Beans 2.6 exception with Excel creation on Android | ||
---|---|---|---|
Product: | POI | Reporter: | Hanzo <ijuan.rm> |
Component: | XSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 3.14-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Bug Depends on: | 59268 | ||
Bug Blocks: |
The same was posted at http://stackoverflow.com/questions/37023667/xml-beans-2-6-exception-with-excel-creation-on-android It is a possible duplicate discussion of http://stackoverflow.com/questions/36596776/poi-duplicate-entry-org-apache-xmlbeans-xml-stream-bindigconfig-class Which in turn links back to https://github.com/andruhon/android5xlsx as possible workaround and bug 59268 as the discussion in POI to avoid this problem. So this bug is mostly not a problem of POI itself and there is ongoing discussion in another bug about a fix for XmlBeans, therefore I am closing this one as duplicate. *** This bug has been marked as a duplicate of bug 59268 *** I've already tested this repo https://github.com/andruhon/android5xlsx With different result but still with problems. If you want you could check my reported issue to this repo: https://github.com/andruhon/android5xlsx/issues/4 Thanks a lot |
I'm trying to create .xlsx documents with the Apache POI 3.14 library. This is my Gradle config: (...) defaultConfig { applicationId "com.example.app" minSdkVersion 14 targetSdkVersion 19 multiDexEnabled true } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt') proguardFile 'Path/app/proguard-rules.pro' } } } dependencies { compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:multidex:1.0.1' //compile files('libs/android-support-v13.jar') compile files('libs/commons-io-2.4.jar') compile files('libs/commons-net-3.3.jar') compile files('libs/poi-3.14-20160307.jar') compile files('libs/poi-ooxml-3.14-20160307.jar') compile files('libs/poi-ooxml-schemas-3.14-20160307.jar') compile files('libs/xmlbeans-2.6.0.jar') compile files('libs/curvesapi-1.03.jar') compile files('libs/commons-codec-1.10.jar') compile files('libs/commons-logging-1.2.jar') compile files('libs/junit-4.12.jar') compile files('libs/log4j-1.2.17.jar') compile 'com.roomorama:caldroid:2.3.1' } With the original xmlbeans library xmlbeans-2.6.0.jar I get this exception when I try to run APP 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've tried to remove the duplicated class with this method -Unzip the jar file. (Simply change .jar extension to .zip -This will remove the duplicate files. -Recreate the jar using jar cf xmlbeans.jar -C (path to unzipped folder) . (Mind it, there is a dot in the end of command) -Use this regenerated jar When I try to run the app with this recompiled .jar I get this warnings but even so it is launched to the device Error:warning: Ignoring InnerClasses attribute for an anonymous inner class Error:(org.apache.xmlbeans.impl.inst2xsd.RussianDollStrategy$1) that doesn't come with an Error:associated EnclosingMethod attribute. This class was probably produced by a Error:compiler that did not target the modern .class file format. The recommended Error:solution is to recompile the class from source, using an up-to-date compiler Error:and without specifying any "-target" type options. The consequence of ignoring Error:this warning is that reflective operations on this class will incorrectly Error:indicate that it is *not* an inner class. (...) Then when in my code try to do : XSSFWorkbook wb = new XSSFWorkbook(); I get this exception and closes the app Caused by: java.lang.NoClassDefFoundError: javax.xml.stream.XMLEventFactory at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41) at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:162) at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:142) at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:37) at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:67) at org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:344) at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:453) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:226) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:218) at com.asde.armatest.persistency.AsyncExcelFile.doInBackground(AsyncExcelFile.java:285) What would be wrong?