Read XLSX on Android demo (using apache poi XSSF)
Switch branches/tags
Nothing to show
Clone or download
Latest commit 2c526a0 Mar 19, 2016

#Not needed any more! Please note that all this hacking is not needed any more with new Android Build Tools 21+ and Android 5 (ART):
Visit this blog post for details:
Generally all you need is to enable multi-dex support and build your project with --core-library option. See also the repo with repacked POI 3.12 jars and gradle config examples:

Please refer to the text below if you still need to maintain Android 4 (Dalvik):

#Reading XLSX on Android 4

A workaround make limited usage of Apache POI XSSF on the Android 4 possible.

Se usage example with Gradle / Android Studio in example. Old Ant example can be found in antbuild branch.

This is actually not "out of box" POI chopped from something like 80K methods down to fit into 65K methods android limit.

JARs to download:

It does work without DX --core-library option because StAX is re-compiled with 'javax' namespace renamed to 'aavax'. So namespace conflict is not possible any more. Strings 'javax/xml/stream', 'javax/xml/namespace' and 'javax.xml.strings' in other binaries replaced with strings containing 'aavax' instead of 'javax'.

Tested with reading and writing XLSX files. It might not work properly if the file contains Drawings or Charts. It also might fail if you try to write some styles. Please let me know if it fails by any reason.

##Building the project with aa-poi-3.10-min-0.1.5.jar and aa-poi-ooxml-schemas-3.10-reduced-more-0.1.5.jar

The jars are still quite large so this might happen that project will touch 65K methods limit if one add any other jars into the project. For example android appcompat Support Library will definitely cause this issue.

##Why? If you try to build Android project with Apache POI XSSF out of box you would face whole bunch of problems:
First and most major one is android's 65K methods limit. poi-ooxml-schemas-3.10-FINAL-20140208.jar contains approximately 68K

([dx] trouble writing output: Too many method references: 67997; max is 65536.)

Read following posts in my blog to see whole process of "porting":

##Known issues It fails to create a new XLSX file with a new sheet. Workaround is in keeping pre-created blank XLSX in app assets and using this file as templates. Populating/writing existing files with existing sheets works fine. Find workaround example in

##Donate / help I don't ask for a donation, but you can join me on the LinkedIN in and endorse my Java skill if you find this hack useful: