Android duplicate class error when including Apache POI

后端 未结 2 1621
感动是毒
感动是毒 2021-01-18 04:22

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 r

相关标签:
2条回答
  • 2021-01-18 04:32

    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.

    0 讨论(0)
  • 2021-01-18 04:37

    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.

    0 讨论(0)
提交回复
热议问题