Skip to content Skip to sidebar Skip to footer

Android Duplicate Class Error When Including Apache Poi

I've got a problem with the apache poi excel api (xlsx). I'm using android studio and I've added the poi libs to the 'libs' folders. This error is popping up for some reason (see b

Solution 1:

Please note that there are a number of problems that you might run into when using Apache POI on Android. The duplicate classes in XmlBeans can currently only be avoided by re-packaging the jar.

There are currently two projects which try to solve most of the problems for you, both re-package all classes including any dependencies into a single jar-file to make it easier to deploy. Also some shading is done to avoid problems with javax-namespace which Android does not allow.

  1. https://github.com/andruhon/android5xlsx
  2. https://github.com/centic9/poi-on-android/ (mainted by me)

The first one is currently based on POI 3.12, whereas the second can be re-compiled with newer versions of POI more easily.

Solution 2:

The xmlbeans 2.6 JAR from Maven Central contains some duplicate class entries. The XMLBeans JIRA has an issue open for the problem. Until they publish a new JAR, I think I'm going to unzip the jar, which will overwrite the duplicates, then re-zip it up and put it in my libs dir for now.

Post a Comment for "Android Duplicate Class Error When Including Apache Poi"