Search code examples
androidapache-poistax

How to satisfy dependencies for Apache POI on Android?


There are many posts about reading .docx files with Apache POI on Android. I write Java program, which do it and want move it Android platform. But XWPFDocument requires xmlbeans.jar, and xmlbeans.jar requires stax-api.jar. And Stax API can not be added to android app, because it tries to extends javax.* namespace, which is not allowed.

So question is: how can I satisfy dependencies for Apache POI on Android?


Solution

  • Update: There is now https://github.com/centic9/poi-on-android which is actively maintained and allows at least the core functionality of Apache POI to be used on Android.

    Some limitations apply, mostly Java AWT related stuff where Android does not provide the related implementation.

    The project also provides a sample-application which shows how some of the functionality can be used.


    Outdated Content:

    There are now at least two projects which try to solve most of the problems when using Apache POI on Android. Only some methods when handling images will still fail because Apache POI uses stuff form java.awt which Android does not have.

    Take a look at

    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.