Bug 61921

Summary: build error while using jar 3.17 version with android
Product: POI Reporter: Prabin Shrestha <prabinshr007123>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 3.17-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description Prabin Shrestha 2017-12-20 11:46:15 UTC
I am using these dependency on my android build.gradle file

implementation group: 'org.apache.poi', name: 'poi', version: '3.17'
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '3.17'
implementation group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.17'

Unfortunately it throws these error while building ...


Android setup
compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }


ERROR :

Execution failed for task ':app:transformClassesWithStackFramesFixerForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class

I couldn't resolve this since i am a beginner.

Could you help,Please ?
Comment 1 PJ Fanning 2017-12-20 12:40:56 UTC
Use https://github.com/pjfanning/xmlbeans instead of Apache XMLBeans.
See the sample linked in the README file.
Comment 2 Dominik Stadler 2017-12-24 11:41:29 UTC
We handle the duplicate classes in XmlBeans in bug #59268, so I am closing this as duplicate. 

However note that there are a number of additional things that may affect you when using Apache POI on Android. 

There is a separate project at https://github.com/centic9/poi-on-android/ which tries to provide a way to more easily get most of these fixed. You may want to take a look there and probably use the single jar-file that is provided as part of that project.

*** This bug has been marked as a duplicate of bug 59268 ***
Comment 3 Prabin Shrestha 2017-12-27 10:30:24 UTC
Thanks