Comments (13)
If this is still a problem then please paste the full build-output as the one line is likely not the actual cause.
from poi-on-android.
Hi,
the build process in android studio finishes with a lot of errors, but the app gets installed on my phone. When I try to create an excel file, with my app installed on the phone, android studio will show the following errors. https://github.com/andruhon/android5xlsx works for me, that’s why I have stopped trying to get it work.
If you like I could close the issue. Or if you like, I could test some different setups/configurations.
Thank you for your help!
org.apache.poi.javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.EventFactory not found
at org.apache.poi.javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
at org.apache.poi.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178)
at org.apache.poi.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
at org.apache.poi.javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)
at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.(PackagePropertiesMarshaller.java:41)
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
at org.apache.poi.openxml4j.opc.OPCPackage.(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:72)
at org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:394)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:475)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:243)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:235)
at com.test.com.excel.saveExcelFile(excelexportservice.java:77)
at com.test.com.excel.onCreate(excelexportservice.java:60)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3807)
at android.app.ActivityThread.access$2100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1882)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
from poi-on-android.
The error message indicates that no XML Parser was found at all, however the poi-shadow.jar should already contain the aalto-xml parser implementation which can be used on Android directly in the shadowed jar.
Maybe you can try to not additionally list the aalto-xml as dependency?
from poi-on-android.
Hi,
attached, you will find the build-Log, the app-crash-log, and the build.gradle. Let me know, what I should change. I did the testing in a new project, to make sure, no other settings are the cause for the crash.
App-crash-Log.pdf
build.gradle.pdf
Build-Log.pdf
from poi-on-android.
How do you use the android poi insert pictures in word
from poi-on-android.
Hi, I'm encountering the same issue: using poi 3.16. The lib creation works fine, building my app as well, but at runtime during sheet production the app crashes with:
org.apache.poi.javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.EventFactory not found
at org.apache.poi.javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
at org.apache.poi.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178)
at org.apache.poi.javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
at org.apache.poi.javax.xml.stream.XMLEventFactory.newInstance(XMLEventFactory.java:30)
at org.apache.poi.openxml4j.opc.internal.marshallers.PackagePropertiesMarshaller.<clinit>(PackagePropertiesMarshaller.java:41)
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:161)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:72)
at org.apache.poi.openxml4j.opc.OPCPackage.create(OPCPackage.java:394)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:475)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:243)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:235)
from poi-on-android.
The shaded jar includes the aalto-xml parser and tries to include service-files to make Android load this XML parser instead of the com.bea default one.
What exact version of Android is this?
And can you try try the workaround mentioned in AOSP issue 59658 comment 22:
right click on /src/main (where you have /java and /res folders),
select New > Folder > Java Resources Folder,
click Finish (do not change Folder Location),
right click on new /resources folder,
select New > Directory
enter "META-INF" (without quotes),
right click on /resources/META-INF folder,
select New > Directory
enter "services" (without quotes)
copy any file you need into /resources/META-INF/services
For you, you'd need to copy this file (javax.xml.stream.XMLInputFactory) into /resources/META-INF/services.
See also the discussion at https://stackoverflow.com/questions/30968735/using-com-bea-xml-stream-package-on-android
from poi-on-android.
Thanks for the quick reaction. Note that the provided test app works fine on the same emulator (the test.xlsx is created). I will first dive into the differences in my app code and the provided test project before trying the steps mentioned above.
from poi-on-android.
Yes, that would be very welcome as I have a few similar reports but cannot reproduce it myself, one likely cause would be some additional dependencies on other third party libs which may cause this.
from poi-on-android.
Hi @centic9,
I was able to fix my app by adding these 3 lines from the sample application:
System.setProperty("org.apache.poi.javax.xml.stream.XMLInputFactory", "com.fasterxml.aalto.stax.InputFactoryImpl");
System.setProperty("org.apache.poi.javax.xml.stream.XMLOutputFactory", "com.fasterxml.aalto.stax.OutputFactoryImpl");
System.setProperty("org.apache.poi.javax.xml.stream.XMLEventFactory", "com.fasterxml.aalto.stax.EventFactoryImpl");
This was not clear from the readme file on the github main page. I guess a short piece of text on the readme might help others!
Thanks for your efforts in providing this fix to make POI available for Android.
Best regards,
Peter
from poi-on-android.
Thanks a lot for the investigation, that makes sense, I added this a while ago and completely forgot about it, sorry for not mentioning this in the README until now.
i would be interested if there is a better way to do this without having to put something like this into the actual application-code!
from poi-on-android.
Javax is not included in android that is why we face this error, is there a way to use this lib without javax?
from poi-on-android.
See the readme and previous comments above for some system properties which make it work.
from poi-on-android.
Related Issues (20)
- Сompile JAR for a particular architecture? HOT 1
- fr.opensagres.poi.xwpf.converter.pdf.PdfConverter HOT 8
- Cannot insert picture in a XWPFDocument HOT 1
- XMLSlideShow解析失败 HOT 3
- Crash due to not able to locate index.xsb HOT 3
- ClassCastException writing Excel file HOT 4
- org.apache.poi.ooxml.POIXMLException HOT 2
- Office to pdf HOT 1
- Unexpected reference to missing service class HOT 6
- Crash when run in app HOT 3
- the width value of cell in the excel looks strange
- java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/geom/Rectangle2D$Doubl HOT 2
- CALL autoSizeColumn NoClassDefFoundError,but set SystemPropeeres tip and set autoSizeColumn , noClassDefoundError SheetUtil HOT 2
- my minSdkVersion 21 HOT 5
- Need donate link!!! HOT 1
- Can not rsolve PdfConverter and PdfOptions HOT 1
- is it CSV Writer includes this library ? HOT 1
- java.lang.NoSuchMethodError: No static method forArray HOT 3
- POITextExtractor bug! docs, xlsx, pptx are OK, but doc file throws Exception! HOT 3
- NoSuchMethodError createExtractor(Ljava/io/InputStream;)Lorg/apache/poi/POITextExtractor HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poi-on-android.