Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoClassDefFoundError: Failed resolution of :Ljavax/XML/stream/XMLEventFactory with Apache POI on Android

I have been trying to write excel sheets to external storage using apache poi library on android but every time I run the app I am getting the error

Failed resolution of :Ljavax/XML/stream/XMLEventFactory

I have read the official documentation for poi and searched Google but in vain. Also I use jdk1.8 but still the error occurs.

like image 835
deshmanth Avatar asked Jan 06 '16 23:01

deshmanth


2 Answers

Currently Apache POI will not work on Android out of the box due to various problems that you will encounter when using the libraries from Apache POI directly.

There are two projects that try to make it possible to use Apache POI on Android:

  • https://github.com/andruhon/android5xlsx (for Android 5) and https://github.com/andruhon/AndroidReadXLSX (for Android 4), both are currently still based on Apache POI 3.12
  • https://github.com/centic9/poi-on-android/ (for Android 5, maintained by me), which can be more easily recompiled with newer versions of POI, e.g. it uses 3.17 currently
like image 135
centic Avatar answered Oct 14 '22 05:10

centic


Add implementation 'javax.xml.stream:stax-api:1.0' in you app build.gradle, as some core class missed

like image 33
Rama Shankar Rao Avatar answered Oct 14 '22 04:10

Rama Shankar Rao