Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

android - POI : duplicate entry: org/apache/xmlbeans/xml/stream/Location.class

Android POI integration. I have done lots of search but did not find solution.

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

My gradle

compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'

compile 'com.google.code.gson:gson:2.4'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.github.rey5137:material:1.2.2'
compile('com.github.afollestad.material-dialogs:core:0.8.5.4@aar') {
    transitive = true
}
compile('com.mikepenz:materialdrawer:5.0.0@aar') {
    transitive = true
}
compile 'com.pnikosis:materialish-progress:1.5'
compile 'org.apache.poi:poi-ooxml:3.13'

I found this https://github.com/sbt/sbt-proguard/issues/9

There is no solution here.

There is no solution here.

There is no solution here.

I did not used any other apache lib. and not used google play service. still the same issue is there.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There a some discussions about how to get POI working on Android, see e.g. http://blog.kondratev.pro/2015/08/reading-xlsx-on-android-4-and-hopefully.html

The blow specifically states

[...] however it will not work straighforwardly because xmlbeans jar in maven is defective and contains duplicates of classes, [...] it is easier just to prepare jars once and put them into libs directory (as described above)

So you might need to do a few things to make it work or you can use the re-packaged project at https://github.com/andruhon/android5xlsx


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...