GithubHelp home page GithubHelp logo

centic9 / poi-on-android Goto Github PK

View Code? Open in Web Editor NEW
331.0 15.0 86.0 1.68 MB

A sample project that shows how Apache POI can be used in an Android application

License: Apache License 2.0

Java 100.00%
android-application poi apache-poi sample-app android

poi-on-android's Introduction

Build Status Gradle Status Release GitHub release

This is a sample Android application to show how Apache POI can be used on Android.

It consists of two projects:

  • poishadow: A small helper project to produce a shaded jar-file for Apache POI which includes all necessary dependencies and fixes a few things that usually hinder you deploying Apache POI on Android
  • poitest: A very small sample Android application which performs some actions on XLSX-, PPTX and DOCX-files using Apache POI. See MainActivity for the actual code

Getting started

Necessary System-Properties

In order to work around problems with finding a suitable XML Parser, currently the following system properties need to be set manually during startup of your application (let me know if you know of a better way to do this, see issue #10)

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");
Supported Android versions

The sample project uses minimum SDK version 26, which maps to Android 8.0. Higher versions should work as well, older ones are likely not supported any more.

Dependencies

Note: Some dependencies of Apache POI are not included in the shading to keep it's size at bay. If you use code areas which require curvesapi, commons-codec or any of the other dependencies, you may need to add them in your Android application in addition to the poishadow-all.jar file dependency.

Missing java.awt classes

Unfortunately Android does not provide any of the classes in package java.awt and thus any code which uses code from there will not work. This affects various places in Apache POI, e.g. when handling column-width, images or other graphical operations.

A few classes have been re-implemented in the src-folder in project poishadow. If you are missing some you might be able to add re-implementations for more there.

We do not plan to fix all of these in this sample application, if you need more, feel free to add it and send PRs if you think it is generally useful.

Use a pre-built jar

If you want to get started quickly, there is a ready-made jar-file available in the release section, however this is not updated frequently, so it may be somewhat outdated at times.

You should be able to simply add this to your Android project and use the Apache POI classes from it.

Build the jar yourself

If you would like to get the most recent jar or if you would like to change how the jar-file is built, e.g. if you need classes that are excluded, use a different version of POI or would like to adjust the build in some other way, you can build the shaded jar with the following steps:

Preparation:

You will need the following pieces in order to get started

Get the code:

git clone https://github.com/centic9/poi-on-android.git
cd poi-on-android

Configure where your Android SDK resides:

echo "sdk.dir=/opt/android-sdk-linux" > local.properties

Configure the version of the Android Build Tools that you have installed.

vi poitest/build.gradle

Then build the shadow-jar (for some reason this works better if executed separately):

./gradlew shadowJar

Finally run the build and some testing. Make sure you have a device connected, e.g. the Android emulator.

./gradlew build connectedCheck

For only the jar-files just run build

Support this project

If you find this tool useful and would like to support it, you can Sponsor the author

Run the Android emulator

List available emulators

<android-sdk>/tools/emulator -list-avds

Start an Android emulator

<android-sdk>/tools/emulator -avd <name>

Install the apk

<android-sdk>/platform-tools/adb install ./poitest/build/outputs/apk/poitest-debug.apk

Notes

  • You can use the resulting jar-file poishadow/build/libs/poishadow-all.jar in your own project, the code in directory poitest is just a small sample Android application to show that it works.
  • This was only tested in Android Studio with the Android emulator until now, should work on real Android as well, though!
  • Tested with targetSdkVersion 26 and minSdkVersion 26

Todo

  • Add more actual functionality to the sample application, currently it just performs some basic functionality on documents.
  • Some parts of the JDK are missing on Android, e.g. AWT-related classes. Some of these are missing when some functionality of Apache POI is used and thus currently crash the sample project. There are some libraries which provide these classes, but none was in a state that allowed it to easily integrate it here.

PR which improve on these items are welcome.

Links

Licensing

Copyright 2015-2024 Dominik Stadler

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

poi-on-android's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

poi-on-android's Issues

Failed to verify instance (org.apache.poi.ss.formula.ptg.EqualPtg) is a singleton.

I get the following error when trying to proguard my code with the suggested rules

2019-05-23 12:01:48.138 24237-24299/omegaonedevelopers.client.omegamaps E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
    Process: omegaonedevelopers.client.omegamaps, PID: 24237
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:354)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.ExceptionInInitializerError
        at org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(Unknown Source:0)
        at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(SourceFile:63)
        at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(SourceFile:12)
        at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(SourceFile:2)
        at org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(SourceFile:2)
        at org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluate(SourceFile:5)
        at omegaonedevelopers.client.omegamaps.MainActivity.a(SourceFile:53)
        at omegaonedevelopers.client.omegamaps.MainActivity.b(SourceFile:2)
        at omegaonedevelopers.client.omegamaps.MainActivity$a.doInBackground(SourceFile:4)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: java.lang.RuntimeException: Failed to verify instance (org.apache.poi.ss.formula.ptg.EqualPtg) is a singleton.
        at org.apache.poi.ss.formula.OperationEvaluatorFactory.put(SourceFile:4)
        at org.apache.poi.ss.formula.OperationEvaluatorFactory.initialiseInstancesMap(SourceFile:2)
        at org.apache.poi.ss.formula.OperationEvaluatorFactory.<clinit>(SourceFile:1)
        at org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(Unknown Source:0) 
        at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(SourceFile:63) 
        at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(SourceFile:12) 
        at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(SourceFile:2) 
        at org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(SourceFile:2) 
        at org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluate(SourceFile:5) 
        at omegaonedevelopers.client.omegamaps.MainActivity.a(SourceFile:53) 
        at omegaonedevelopers.client.omegamaps.MainActivity.b(SourceFile:2) 
        at omegaonedevelopers.client.omegamaps.MainActivity$a.doInBackground(SourceFile:4) 
        at android.os.AsyncTask$2.call(AsyncTask.java:333) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 

When running to get this code

private String getCellValue(FormulaEvaluator evaluator, Cell cell){
        String cellString = "";
        try {
            CellValue cellValue = evaluator.evaluate(cell);
            if(cellValue != null){
                switch (cellValue.getCellType()) {
                    case Cell.CELL_TYPE_BOOLEAN:
                        cellString = Boolean.toString(cellValue.getBooleanValue());
                        break;
                    case Cell.CELL_TYPE_NUMERIC:
                        cellString = Double.toString(cellValue.getNumberValue());
                        break;
                    case Cell.CELL_TYPE_STRING:
                        cellString = cellValue.getStringValue();
                        break;
                }
            }
        } catch (Exception e) {
            Log.e(TAG, e.getMessage());
        }
        return cellString;
    }

Suggestion

Can you please add to description:
need to add jar file and compile 'org.apache.commons:commons-text:1.1' to gradle
add in Activity onCreate
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");

java.lang.VerifyError: org/openxmlformats/schemas/wordprocessingml/x2006/main/impl/CTFtnEdnImpl

on android 4.2
I have add
-keep class org.openxmlformats.** { ; }
-keep class org.openxmlformats.
* { *; }

    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");

Also report
Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTCustomXmlBlock', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTFtnEdnImpl.insertNewCustomXml
09-22 19:35:19.394 2606
.....
java.lang.VerifyError: org/openxmlformats/schemas/wordprocessingml/x2006/main/impl/CTFtnEdnImpl
.....

WorkbookFactory don't work

I tried to open a file that I need to edit with the InputStream. The file size is ~1mb.

File file = getExternalPath();   // here I get target file    
        if(!file.exists()){
            messageTextView.setText("File not found");
            return;
        }
        try (InputStream inp = new FileInputStream(file))
         {
            Workbook wb = WorkbookFactory.create(inp);
            messageTextView.setText(String.valueOf(wb.getNumberOfSheets()));
        } catch (IOException ex) {
            messageTextView.setText(ex.getMessage());
       }

And it works, but the function wb.getNumberOfSheets() is processed 30-50 seconds! That is, the application for this time just hangs. And in general, whenever you turn to the book, there is such a hang. However, if you refer to an empty excel file, the function executes instantly. The documentation "Apache poi" states that the use of InputStream requires more memory than using the file. I tried to connect to the book using a File.

Workbook wb = WorkbookFactory.create(file);

But thus I receive exception:

org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream cannot be cast to java.util.zip.ZipFile$RAFStream

I can not understand what the problem is again :/

Error on using Sheet.autoSizeColumn

When trying to use autoSizeColumn from the Sheet class on Android the class java.awt.font.FontRenderContext is missing. Can somebody help to including it? Tried but I couldn't. Thanks

CellStyle Does Not Works On Android

The CellStyle Class Internally Uses java.awt.Color Class To Apply Styles To Cell. So This Creates An Exception In Android POI Usage. Is There Any Fix Or Work Around To Tackle This?

Class 'org.apache.xmlbeans.impl.store.Cur' does not implement interface 'java.util.List' in call to 'int java.util.List.size()'

Please, Help me, why I have this erro?

    java.lang.IncompatibleClassChangeError: Class 'org.apache.xmlbeans.impl.store.Cur' does not implement interface 'java.util.List' in call to 'int java.util.List.size()' (declaration of 'org.apache.xmlbeans.impl.store.Saver' appears in base.apk!classes5.dex)
        at org.apache.xmlbeans.impl.store.Saver.pushMappings(Saver.java:546)
        at org.apache.xmlbeans.impl.store.Saver.processElement(Saver.java:406)
        at org.apache.xmlbeans.impl.store.Saver.process(Saver.java:307)
        at org.apache.xmlbeans.impl.store.Saver.<init>(Saver.java:123)
        at org.apache.xmlbeans.impl.store.Saver$TextSaver.<init>(Saver.java:916)
        at org.apache.xmlbeans.impl.store.Saver$InputStreamSaver.<init>(Saver.java:2468)
        at org.apache.xmlbeans.impl.store.Cursor._newInputStream(Cursor.java:550)
        at org.apache.xmlbeans.impl.store.Cursor._save(Cursor.java:579)
        at org.apache.xmlbeans.impl.store.Cursor.save(Cursor.java:2544)
        at org.apache.xmlbeans.impl.values.XmlObjectBase.save(XmlObjectBase.java:223)
        at org.apache.poi.POIXMLProperties.commit(POIXMLProperties.java:225)
        at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:225)
        at cn.nanming.smartsupervision.core.manager.doc.DocManager.testTemplateWrite(DocManager.java:355)
        at cn.nanming.smartsupervision.ui.activity.microenterprisemanage.MicroApplicationDetailActivity.saveDoc(MicroApplicationDetailActivity.java:1194)
        at cn.nanming.smartsupervision.ui.activity.microenterprisemanage.MicroApplicationDetailActivity.access$2900(MicroApplicationDetailActivity.java:87)
        at cn.nanming.smartsupervision.ui.activity.microenterprisemanage.MicroApplicationDetailActivity$16.onResult(MicroApplicationDetailActivity.java:1229)
        at cn.nanming.smartsupervision.ui.activity.microenterprisemanage.MicroApplicationDetailActivity$16.onResult(MicroApplicationDetailActivity.java:1222)
        at cn.nanming.smartsupervision.core.requester.SimpleHttpRequester.onFinish(SimpleHttpRequester.java:47)
        at cn.nanming.smartsupervision.core.requester.HttpRequester$1.onSuccess(HttpRequester.java:72)
        at com.loopj.android.http.TextHttpResponseHandler.onSuccess(TextHttpResponseHandler.java:118)
        at com.loopj.android.http.AsyncHttpResponseHandler.handleMessage(AsyncHttpResponseHandler.java:351)
        at com.loopj.android.http.AsyncHttpResponseHandler$ResponderHandler.handleMessage(AsyncHttpResponseHandler.java:510)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:6990)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

NoClassDefFoundError: org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory

Hello,

I noticed that for a device on Kitkat (API 19), when I import an Excel file by calling:

wb = WorkbookFactory.create(inStream);

I get the following error:

org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
                                                                       at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:63)
                                                                       at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:625)
                                                                       at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:185)
                                                                       at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:280)
                                                                       at com.example.lexicav1.ItemListActivity.onActivityResult(ItemListActivity.java:909)
                                                                       at android.app.Activity.dispatchActivityResult(Activity.java:5639)
                                                                       at android.app.ActivityThread.deliverResults(ActivityThread.java:3637)
                                                                       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3684)
                                                                       at android.app.ActivityThread.access$1300(ActivityThread.java:166)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:136)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5584)
                                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
                                                                       at dalvik.system.NativeStart.main(Native Method)
                                                                    Caused by: java.lang.reflect.InvocationTargetException
                                                                       at java.lang.reflect.Constructor.constructNative(Native Method)
                                                                       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                                                                       at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)
                                                                       at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:60)
                                                                       at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:625) 
                                                                       at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:185) 
                                                                       at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:280) 
                                                                       at com.example.lexicav1.ItemListActivity.onActivityResult(ItemListActivity.java:909) 
                                                                       at android.app.Activity.dispatchActivityResult(Activity.java:5639) 
                                                                       at android.app.ActivityThread.deliverResults(ActivityThread.java:3637) 
                                                                       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3684) 
                                                                       at android.app.ActivityThread.access$1300(ActivityThread.java:166) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                       at android.os.Looper.loop(Looper.java:136) 
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5584) 
                                                                       at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                       at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) 
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) 
                                                                       at dalvik.system.NativeStart.main(Native Method) 
                                                                    Caused by: java.lang.NoClassDefFoundError: org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory
                                                                       at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:85)
                                                                       at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                                       at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                                                       at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56) 
                                                                       at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:60) 
                                                                       at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:625) 
                                                                       at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:185) 
                                                                       at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:280) 
                                                                       at com.example.lexicav1.ItemListActivity.onActivityResult(ItemListActivity.java:909) 
                                                                       at android.app.Activity.dispatchActivityResult(Activity.java:5639) 
                                                                       at android.app.ActivityThread.deliverResults(ActivityThread.java:3637) 
                                                                       at android.app.ActivityThread.handleSendResult(ActivityThread.java:3684) 
                                                                       at android.app.ActivityThread.access$1300(ActivityThread.java:166) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1331) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                       at android.os.Looper.loop(Looper.java:136) 
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5584) 
                                                                       at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                       at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1268) 
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) 
                                                                       at dalvik.system.NativeStart.main(Native Method)

The thing is, is that from all the devices I have tested so far that have been Marshmallow, this error does not exist and it can find ThemeDocument$Factory.

I did not use your pre-built jar, and instead built the jar myself from your code by simply modifying the build.gradle file in the poishadow folder. I simply commented out the following line:

exclude 'org/openxmlformats/schemas/drawingml/**'

Then I added the jar file to my project, which only works on >= API 21 devices it seems.

My app's gradle file looks like the following:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId 'com.example.myproject'
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    buildTypes {
        debug {
            debuggable true
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    productFlavors {
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        //exclude 'META-INF/NOTICE.txt'
        //exclude 'META-INF/LICENSE'
        //exclude 'META-INF/LICENSE.txt'
    }

    //It seemed like without this, building the project would fail for my device which is <= api 19
    dexOptions {
        javaMaxHeapSize "4g"
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    //I have a number of dependencies here, then I have the poishadow-all:
    compile project(':poishadow-all')
    compile 'com.android.support:multidex:1.0.1'
}

Thank you for your response

Issue opening docx file

I'm trying to use the latest poishadow-all.jar (I've also tried building my own with some tweaking), and running the poitest app, which seems fine as it is creating a excel document.

This issue I'm running into is when opening an existing docx file, simply by inserting this block in the poitest DocumentListActivity.java:

    try {
        File source = new File(Environment.getExternalStorageDirectory(), "Lorum_Ipsum.docx");
        FileInputStream fis = new FileInputStream(source);
        Document document = new XWPFDocument(fis);
    } catch (Exception e) {
        Log.e("ERROR", e.getLocalizedMessage());
    }

Lorum_Ipsum.docx exists in the root of the storage directory, and can be opened by other document editing apps. I've attached it here.
Lorem_Ipsum.docx

The exception I am getting from this line: "Document document = new XWPFDocument(fis);" is:

org.apache.xmlbeans.SchemaTypeLoaderException: Cannot resolve type for handle _XY_Q=space|R=space@http://www.w3.org/XML/1998/namespace (schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.cttext7f5btype) - code 13

I can see in the proguard rules there is this line:
-keep class schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.TypeSystemHolder

I'm not sure if another reference is missing for this.

Not working with API 19

Hi, this works but not on API 19. Is there a way to make it compatible for devices on API 19 and lower?

Crashing on API 19

A bunch of errors appear related to the ooxml.schemas, examples:

Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtensionList', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSstImpl.getExtLst

Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSstImpl$1SiList', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSstImpl.getSiList

Related to the actual crash:

FATAL EXCEPTION: main Process: ipleiria.project.add, PID: 6186 java.lang.IllegalStateException: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException at ipleiria.project.add.utils.FileUtils.readExcel(FileUtils.java:182) at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:70) at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:67) at ipleiria.project.add.data.source.database.ItemsRepository$1.onDataChange(ItemsRepository.java:115) at com.google.firebase.database.Query$1.onDataChange(Unknown Source) at com.google.android.gms.internal.zzbpx.zza(Unknown Source) at com.google.android.gms.internal.zzbqx.zzZV(Unknown Source) at com.google.android.gms.internal.zzbra$1.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:63) at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:604) at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:186) at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:296) at ipleiria.project.add.utils.FileUtils.readExcel(FileUtils.java:138) at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:70)  at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:67)  at ipleiria.project.add.data.source.database.ItemsRepository$1.onDataChange(ItemsRepository.java:115)  at com.google.firebase.database.Query$1.onDataChange(Unknown Source)  at com.google.android.gms.internal.zzbpx.zza(Unknown Source)  at com.google.android.gms.internal.zzbqx.zzZV(Unknown Source)  at com.google.android.gms.internal.zzbra$1.run(Unknown Source)  at android.os.Handler.handleCallback(Handler.java:733)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5017)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56) at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:60) at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:604)  at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:186)  at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:296)  at ipleiria.project.add.utils.FileUtils.readExcel(FileUtils.java:138)  at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:70)  at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:67)  at ipleiria.project.add.data.source.database.ItemsRepository$1.onDataChange(ItemsRepository.java:115)  at com.google.firebase.database.Query$1.onDataChange(Unknown Source)  at com.google.android.gms.internal.zzbpx.zza(Unknown Source)  at com.google.android.gms.internal.zzbqx.zzZV(Unknown Source)  at com.google.android.gms.internal.zzbra$1.run(Unknown Source)  at android.os.Handler.handleCallback(Handler.java:733)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5017)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.VerifyError: org/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTRstImpl at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createUnattachedNode(SchemaTypeImpl.java:1934) at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createElementType(SchemaTypeImpl.java:1051) at org.apache.xmlbeans.impl.values.XmlObjectBase.create_element_user(XmlObjectBase.java:938) at org.apache.xmlbeans.impl.store.Xobj.getUser(Xobj.java:1675) at org.apache.xmlbeans.impl.store.Xobj.find_all_element_users(Xobj.java:2098) at org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSstImpl.getSiArray(Unknown Source) at org.apache.poi.xssf.model.SharedStringsTable.readFrom(SharedStringsTable.java:123) at org.apache.poi.xssf.model.SharedStringsTable.<init>(SharedStringsTable.java:107) at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:56)  at org.apache.poi.POIXMLFactory.createDocumentPart(POIXMLFactory.java:60)  at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:604)  at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:186)  at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:296)  at ipleiria.project.add.utils.FileUtils.readExcel(FileUtils.java:138)  at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:70)  at ipleiria.project.add.view.categories.CategoriesPresenter$1$1.onComplete(CategoriesPresenter.java:67)  at ipleiria.project.add.data.source.database.ItemsRepository$1.onDataChange(ItemsRepository.java:115)  at com.google.firebase.database.Query$1.onDataChange(Unknown Source)  at com.google.android.gms.internal.zzbpx.zza(Unknown Source)  at com.google.android.gms.internal.zzbqx.zzZV(Unknown Source)  at com.google.android.gms.internal.zzbra$1.run(Unknown Source)  at android.os.Handler.handleCallback(Handler.java:733)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5017)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  at dalvik.system.NativeStart.main(Native Method) 

Exception on creating Worksheet with Android 4.0.3

Hi,

I'm trying to open a xlsm file, add data in it and save it. File is opened and saved from external storage.

It works fine on Android 6.0 but when I try on Android 4.0.3, it raises an ExceptionInInializeError (see attached). It happens on the line :
XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(file)); (see full file SessionDAO.java attached).

I sadly have to make it work with the device on 4.0.3 and can't update it to newer Android version.

Do you know why it raises this exception and how I could have it working ?

Thanks for your feedback,
Théo
SessionDAO.java.txt
exception

Unable to build gradle after adding ooxml-shemas

After adding poishadow-all.jar and
implementation('org.apache.poi:ooxml-schemas:1.0'){
exclude group: 'org.apache.xmlbeans'
}
and I got this Error:
Duplicate class org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource found in modules ooxml-schemas-1.0.jar (org.apache.poi:ooxml-schemas:1.0) and poishadow-all.jar (poishadow-all.jar)
Duplicate class org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource$Factory found in modules ooxml-schemas-1.0.jar (org.apache.poi:ooxml-schemas:1.0) and poishadow-all.jar (poishadow-all.jar)

XLSX Files, Provider com.bea.xml.stream.EventFactory not found

My simple code:

InputStream myInput;
// initialize asset manager
AssetManager assetManager = getAssets();
// open excel sheet
InputStream fin = openFileInput("myexcelsheet.xlsx");
// Create a workbook using the File System
XSSFWorkbook myWorkBook = new XSSFWorkbook(fin);

Produces Provider com.bea.xml.stream.EventFactory not found

Build errors when using Android Built tools 3.0.0-beta1

When using the 3.0.0-beta1, API 23 or lower and the following statement in the build.gradle file:

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
}

causes the following exception during a build:

:app:transformClassesWithDesugarForDebug
Exception in thread "main" java.lang.IllegalStateException: Expect only the fields in this interface to be initialized. owner=org/apache/xmlbeans/impl/xb/ltgfmt/Code$1, expected=org/apache/xmlbeans/impl/xb/ltgfmt/Code
	at com.google.common.base.Preconditions.checkState(Preconditions.java:721)
	at com.google.devtools.build.android.desugar.InterfaceDesugaring$InterfaceFieldWriteCollector.visitFieldInsn(InterfaceDesugaring.java:260)
	at org.objectweb.asm.MethodVisitor.visitFieldInsn(Unknown Source)
	at org.objectweb.asm.tree.FieldInsnNode.accept(Unknown Source)
	at org.objectweb.asm.tree.InsnList.accept(Unknown Source)
	at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
	at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitEnd(LambdaDesugaring.java:383)
	at org.objectweb.asm.ClassReader.b(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
	at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
	at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
	at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:583)


 FAILED

FAILURE: Build failed with an exception.

Steps to reproduce:
-create a new Sample project (API 23, no activity) in Android Studio using build tools 3.0.0-beta1 (note: problem only occurs when API < 24)
-add multidex to the build.gradle
-add the provided poishadow-all.jar to the libs dir
-run gradle assembleDebug: it will run fine
-add these lines to the build.gradle file:

 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
}

-run gradle assembleDebug: it show the exception.

When the minsdk is changed to >23 the build will run fine.

Error on evaluator on AsyncTask android Pie

Hey I'm using an formula evaluator, and while running on the main thread it works as it should. But when on a AsyncTask, I got a RuntimeException and a almost infinite stack trace. This is happening in android Pie, but in Android 5.1 it works well. Any known issues on this?

Thanks!

Application hangs when loading XLSX file

I'm trying to use this lib to read and write XLSX files.
Here's my code repo: https://github.com/anta40/StockChecker.

Some relevant parts:
MainActivity.java

package com.anta40.app.stockchecker;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.github.angads25.filepicker.controller.DialogSelectionListener;
import com.github.angads25.filepicker.model.DialogConfigs;
import com.github.angads25.filepicker.model.DialogProperties;
import com.github.angads25.filepicker.view.FilePickerDialog;

import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;

public class MainActivity extends AppCompatActivity {

    Button btnPickFile;
    final int MY_REQUEST_CODE = 13245;
    final int PERMISSIONS_REQUEST_CODE = 0;
    final int FILE_PICKER_REQUEST_CODE = 1;
    FilePickerDialog dialog;
    Workbook wb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initFasterXML();

        btnPickFile = (Button) findViewById(R.id.btnPickFile);
        btnPickFile.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogProperties properties = new DialogProperties();
                properties.selection_mode = DialogConfigs.SINGLE_MODE;
                properties.selection_type = DialogConfigs.FILE_SELECT;
                properties.root = new File(DialogConfigs.DEFAULT_DIR);
                properties.error_dir = new File(DialogConfigs.DEFAULT_DIR);
                properties.offset = new File(DialogConfigs.DEFAULT_DIR);
                properties.extensions = new String[] {"xlsx"};

                dialog = new FilePickerDialog(MainActivity.this,properties);
                dialog.setTitle("Select XLSX file");

                dialog.setDialogSelectionListener(new DialogSelectionListener() {
                    @Override
                    public void onSelectedFilePaths(String[] files) {
                        try {
                            int count = 0;
                            FileInputStream excelFile = new FileInputStream(new File(files[0]));
                            wb = new XSSFWorkbook(excelFile);
                            Sheet sheet = wb.getSheetAt(0);
                            Iterator<Row> rowIterator = sheet.iterator();

                            while (rowIterator.hasNext()){
                                count += 1;
                            }

                            excelFile.close();

                            Toast.makeText(getApplicationContext(), "Row count: "+count, Toast.LENGTH_SHORT).show();

                        }
                        catch (FileNotFoundException fnfe){
                            Toast.makeText(getApplicationContext(), fnfe.getMessage(), Toast.LENGTH_SHORT).show();
                        }
                        catch (IOException ioe){
                            Toast.makeText(getApplicationContext(), ioe.getMessage(), Toast.LENGTH_SHORT).show();
                        }
                    }
                });

                dialog.show();

            }
        });
    }

    private void initFasterXML(){
        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");
    }
}

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.anta40.app.stockchecker"
        minSdkVersion 15
        targetSdkVersion 28
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions{
        // exclude 'META-INF/DEPENDENCIES'  <--- and try commenting this out, I don't believe it should be needed
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        pickFirst 'META-INF/services/javax.xml.stream.XMLInputFactory'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.github.angads25:filepicker:1.1.1'
    implementation files('lib\\poishadow-all.jar')
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}

Every time the app tries to load XLSX file, it will hang. There's no usable hint at logcat. But, if initFasterXML() inside onCreate() is commented, app will crash. Here's the log:

2019-05-11 21:10:49.149 9824-9824/com.anta40.app.stockchecker E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.anta40.app.stockchecker, PID: 9824
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:97)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:295)
at com.anta40.app.stockchecker.MainActivity$1$1.onSelectedFilePaths(MainActivity.java:69)
at com.github.angads25.filepicker.view.FilePickerDialog$1.onClick(FilePickerDialog.java:131)
at android.view.View.performClick(View.java:6266)
at android.view.View$PerformClick.run(View.java:24730)
at android.os.Handler.handleCallback(Handler.java:793)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:173)
at android.app.ActivityThread.main(ActivityThread.java:6698)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:782)
2019-05-11 21:10:49.218 9824-9824/com.anta40.app.stockchecker I/Process: Sending signal. PID: 9824 SIG: 9

I use Android Studio 3.4, and my device runs Android O.

Class not found

#Class not found#
02-24 17:04:59.072 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBackground', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTDocumentBaseImpl.addNewBackground
02-24 17:04:59.072 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBackground', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTDocumentBaseImpl.getBackground
02-24 17:04:59.074 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBackground', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTDocumentBaseImpl.setBackground
02-24 17:04:59.158 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAltChunk', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.addNewAltChunk
02-24 17:04:59.160 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTCustomXmlBlock', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.addNewCustomXml
02-24 17:04:59.162 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMath', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.addNewOMath
02-24 17:04:59.162 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMathPara', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.addNewOMathPara
02-24 17:04:59.163 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPerm', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.addNewPermEnd
02-24 17:04:59.164 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPermStart', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.addNewPermStart
02-24 17:04:59.166 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAltChunk', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getAltChunkArray
02-24 17:04:59.166 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAltChunk[]', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getAltChunkArray
02-24 17:04:59.167 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1AltChunkList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getAltChunkList
02-24 17:04:59.169 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1BookmarkEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getBookmarkEndList
02-24 17:04:59.170 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1BookmarkStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getBookmarkStartList
02-24 17:04:59.171 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CommentRangeEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCommentRangeEndList
02-24 17:04:59.172 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CommentRangeStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCommentRangeStartList
02-24 17:04:59.173 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTCustomXmlBlock', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlArray
02-24 17:04:59.173 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTCustomXmlBlock[]', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlArray
02-24 17:04:59.174 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlDelRangeEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlDelRangeEndList
02-24 17:04:59.175 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlDelRangeStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlDelRangeStartList
02-24 17:04:59.176 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlInsRangeEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlInsRangeEndList
02-24 17:04:59.177 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlInsRangeStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlInsRangeStartList
02-24 17:04:59.178 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlList
02-24 17:04:59.179 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlMoveFromRangeEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlMoveFromRangeEndList
02-24 17:04:59.180 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlMoveFromRangeStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlMoveFromRangeStartList
02-24 17:04:59.181 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlMoveToRangeEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlMoveToRangeEndList
02-24 17:04:59.183 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1CustomXmlMoveToRangeStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getCustomXmlMoveToRangeStartList
02-24 17:04:59.184 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1DelList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getDelList
02-24 17:04:59.185 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1InsList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getInsList
02-24 17:04:59.186 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1MoveFromList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getMoveFromList
02-24 17:04:59.188 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1MoveFromRangeEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getMoveFromRangeEndList
02-24 17:04:59.189 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1MoveFromRangeStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getMoveFromRangeStartList
02-24 17:04:59.191 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1MoveToList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getMoveToList
02-24 17:04:59.191 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1MoveToRangeEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getMoveToRangeEndList
02-24 17:04:59.192 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1MoveToRangeStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getMoveToRangeStartList
02-24 17:04:59.193 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMath', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getOMathArray
02-24 17:04:59.194 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMath[]', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getOMathArray
02-24 17:04:59.195 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1OMathList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getOMathList
02-24 17:04:59.196 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMathPara', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getOMathParaArray
02-24 17:04:59.197 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMathPara[]', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getOMathParaArray
02-24 17:04:59.198 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1OMathParaList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getOMathParaList
02-24 17:04:59.199 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1PList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getPList
02-24 17:04:59.200 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPerm', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getPermEndArray
02-24 17:04:59.201 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPerm[]', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getPermEndArray
02-24 17:04:59.202 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1PermEndList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getPermEndList
02-24 17:04:59.202 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPermStart', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getPermStartArray
02-24 17:04:59.203 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPermStart[]', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getPermStartArray
02-24 17:04:59.204 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1PermStartList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getPermStartList
02-24 17:04:59.205 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1ProofErrList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getProofErrList
02-24 17:04:59.206 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1SdtList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getSdtList
02-24 17:04:59.207 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl$1TblList', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.getTblList
02-24 17:04:59.208 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAltChunk', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.insertNewAltChunk
02-24 17:04:59.209 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTCustomXmlBlock', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.insertNewCustomXml
02-24 17:04:59.211 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMath', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.insertNewOMath
02-24 17:04:59.212 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.officeDocument.x2006.math.CTOMathPara', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.insertNewOMathPara
02-24 17:04:59.212 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPerm', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.insertNewPermEnd
02-24 17:04:59.213 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPermStart', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.insertNewPermStart
02-24 17:04:59.216 20833-20833/com.ua4ever.ua.eocrx E/dalvikvm: Could not find class 'org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAltChunk', referenced from method org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTBodyImpl.setAltChunkArray
02-24 17:04:59.281 20833-20833/com.ua4ever.ua.eocrx E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.VerifyError: org/openxmlformats/schemas/wordprocessingml/x2006/main/impl/CTBodyImpl
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createUnattachedNode(SchemaTypeImpl.java:1934)
at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createElementType(SchemaTypeImpl.java:1051)
at org.apache.xmlbeans.impl.values.XmlObjectBase.create_element_user(XmlObjectBase.java:938)
at org.apache.xmlbeans.impl.store.Xobj.getUser(Xobj.java:1675)
at org.apache.xmlbeans.impl.store.Cur.getUser(Cur.java:2659)
at org.apache.xmlbeans.impl.store.Xobj.insertElement(Xobj.java:2117)
at org.apache.xmlbeans.impl.store.Xobj.add_element_user(Xobj.java:2197)
at org.openxmlformats.schemas.wordprocessingml.x2006.main.impl.CTDocument1Impl.addNewBody(Unknown Source)
at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentCreate(XWPFDocument.java:271)
at org.apache.poi.xwpf.usermodel.XWPFDocument.(XWPFDocument.java:124)
at com.ua4ever.ua.eocrx.util.DocumenterWord.exportToWord(DocumenterWord.java:75)
at com.ua4ever.ua.eocrx.TextActivity.tombolExport(TextActivity.java:75)
at com.ua4ever.ua.eocrx.TextActivity.onOptionsItemSelected(TextActivity.java:66)
at android.app.Activity.onMenuItemSelected(Activity.java:2638)
at android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:408)
at android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:195)
at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113)
at android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:113)
at android.support.v7.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:69)
at android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:206)
at android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:776)
at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156)
at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:969)
at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:959)
at android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:623)
at android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:154)
at android.view.View.performClick(View.java:4212)
at android.view.View$PerformClick.run(View.java:17485)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5426)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)

How to build jar file

i managed to get the clone of the project, but i did not understood the next steps, what do you mean by
Configure where your Android SDK resides ? how do i do that? Please help

Cannot get it to work

Hi Dominik,
thank you for your great work. But I just cannot get it to work. I tried it with a new project (android studio), but still facing a lot of warnings during build process, but anyhow the app gets installed on my phone. But my app crashes with the following warning:

org.apache.poi.javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.EventFactory not found

Here is my build gradle:
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "myapp.testexcel"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
testCompile 'junit:junit:4.12'
compile files('libs/poishadow-all.jar')
compile 'com.fasterxml:aalto-xml:1.0.0'
}

That is one of the warnings:
Error:(org.apache.xmlbeans.XmlBeans$1) that doesn't come with an

Could you please give me a step by step instruction?
I was able to create excel files with only the poi-3.15.jar file; with HSSFWorkbook(). This works great for smaller excel files, but if they get a little bit bigger, windows 7 excel can’t open them anymore (but on my android device they open just fine). So I tried to use XSSFWorkbook(). That’s why I came to your project.

This project is working on my PC (android studio) https://github.com/andruhon/android5xlsx

Error while merging dex archives

hey, i got an issue, when trying to run the app i got this error

Program type already present: org.apache.poi.openxml4j.exceptions.ODFNotOfficeXmlFileException
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
at sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)

any solution to this problem ?

java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Color;

Hello. I'm using Android Studio 3.0.x, and imported your poishadow-all.jar v0.5
I tried my own code of importing excel from POI 3.12 to your version and it's works quite fine,
but when I tried to import MPP file using MPXJ 7.2.1 I got that I don't have a library and crash.

I saw your solution, spent a lot of hours, but I don't understand how to override awt/Color with your solution. Please, help.

Crash on read:
MPPReader reader = new MPPReader();
String path2file = context.getFilesDir() + "/" +SAMPLE21_MPPX;
ProjectFile projectFile = reader.read(path2file);

here is full error:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.bio.tj, PID: 13427
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Color;
at net.sf.mpxj.mpp.MPPUtility.getColor(MPPUtility.java:543)
at net.sf.mpxj.mpp.GanttChartView14.getFontStyle(GanttChartView14.java:258)
at net.sf.mpxj.mpp.GanttChartView14.processViewProperties(GanttChartView14.java:143)
at net.sf.mpxj.mpp.GanttChartView.(GanttChartView.java:140)
at net.sf.mpxj.mpp.GanttChartView14.(GanttChartView14.java:403)
at net.sf.mpxj.mpp.ViewFactory14.createView(ViewFactory14.java:56)
at net.sf.mpxj.mpp.MPP14Reader.processViewData(MPP14Reader.java:1790)
at net.sf.mpxj.mpp.MPP14Reader.process(MPP14Reader.java:104)
at net.sf.mpxj.mpp.MPPReader.read(MPPReader.java:158)
at net.sf.mpxj.mpp.MPPReader.read(MPPReader.java:80)
at net.sf.mpxj.reader.AbstractProjectReader.read(AbstractProjectReader.java:49)
at com.example.bio.tj.Parsers.ParserMPPX.parseMPPX_importToPTS(ParserMPPX.java:21)
at com.example.bio.tj.MainActivity.onButtonGetProjectMPPXClick(MainActivity.java:1370)
at com.example.bio.tj.MainActivity_ViewBinding$12.doClick(MainActivity_ViewBinding.java:147)
at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
at android.view.View.performClick(View.java:4756)
at android.view.View$PerformClick.run(View.java:19749)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.awt.Color" on path: DexPathList[[zip file "/data/app/com.example.bio.tj-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.bio.tj-2/lib/x86_64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at net.sf.mpxj.mpp.MPPUtility.getColor(MPPUtility.java:543) 
at net.sf.mpxj.mpp.GanttChartView14.getFontStyle(GanttChartView14.java:258) 
at net.sf.mpxj.mpp.GanttChartView14.processViewProperties(GanttChartView14.java:143) 
at net.sf.mpxj.mpp.GanttChartView.(GanttChartView.java:140) 
at net.sf.mpxj.mpp.GanttChartView14.(GanttChartView14.java:403) 
at net.sf.mpxj.mpp.ViewFactory14.createView(ViewFactory14.java:56) 
at net.sf.mpxj.mpp.MPP14Reader.processViewData(MPP14Reader.java:1790) 
at net.sf.mpxj.mpp.MPP14Reader.process(MPP14Reader.java:104) 
at net.sf.mpxj.mpp.MPPReader.read(MPPReader.java:158) 
at net.sf.mpxj.mpp.MPPReader.read(MPPReader.java:80) 
at net.sf.mpxj.reader.AbstractProjectReader.read(AbstractProjectReader.java:49) 
at com.example.bio.tj.Parsers.ParserMPPX.parseMPPX_importToPTS(ParserMPPX.java:21) 
at com.example.bio.tj.MainActivity.onButtonGetProjectMPPXClick(MainActivity.java:1370) 
at com.example.bio.tj.MainActivity_ViewBinding$12.doClick(MainActivity_ViewBinding.java:147) 
at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) 
at android.view.View.performClick(View.java:4756) 
at android.view.View$PerformClick.run(View.java:19749) 
at android.os.Handler.handleCallback(Handler.java:739) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5221) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
Suppressed: java.lang.ClassNotFoundException: java.awt.Color
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 26 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Error in POIMetadataExtracter

Adding properties to activity:
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");
Causes error: org.apache.xmlbeans.SchemaTypeLoaderException: Cannot resolve type for handle _XY_Q=space|R=space@http://www.w3.org/XML/1998/namespace (schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.cttext7f5btype) - code 13

Provider com.bea.xml.stream.EventFactory not found

I try to read an xlsx file from an InputStream

            workbook = new XSSFWorkbook(is);

which yields

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:96)
     at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:342)
     at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
     at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:285)

Running into classcast exceptions, new proguard lines are required to fix this

When using the proguard file of this project as input, my app crashes with the following exception:

Exception java.lang.ClassCastException: org.apache.xmlbeans.impl.g.au cannot be cast to org.openxmlformats.schemas.spreadsheetml.x2006.main.al
org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorksheetImpl.addNewPrintOptions (CTWorksheetImpl.java)
org.apache.poi.xssf.usermodel.XSSFSheet.setPrintGridlines (XSSFSheet.java:1798

I ended up solving this by adding these lines to the proguard file:

-keep class org.openxmlformats.schemas.spreadsheetml.x2006.main** { *; }
-keep class org.openxmlformats.schemas.spreadsheetml.x2006.main.impl** { *; }

After this my app does no longer crashes, but the APK file is increased with approx 200kb. Adding classes such as org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorksheetImpl to the proguard configuration does not solve the crashes.

I'm very interested in any solution to keep the APK as small as possible.

Use InputStream get file xlxs from storage when progurad don't work :(

org.apache.a.c: java.lang.NoSuchMethodException: [class org.apache.a.e.b.c]
at org.apache.a.d.a(SourceFile:63)
at org.apache.a.b.a(SourceFile:580)
at org.apache.a.a.a(SourceFile:186)
at org.apache.a.i.b.av.(SourceFile:300)
at tienbm.lichhoc.a.d.a(SourceFile:63)
at tienbm.lichhoc.a.d.doInBackground(SourceFile:33)
at android.os.AsyncTask$2.call(AsyncTask.java:295)

Release build throws a OpenXML4JRuntimeException: Fail to save: error

Good day!
Whenever I run my android application on release mode it crashes on XWPFDocument.write(out) with the following error.

org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException: Fail to save: an error occurs while saving the package: The part /docProps/app.xml failed to be saved in the stream with marshaller org.apache.poi.openxml4j.opc.internal.marshallers.DefaultMarshaller@29b8687

I tried to google the error but I couldn't find a solution that worked for me.

public class DocumentParser extends Thread {
private XWPFDocument _document;

private DocumentInformation _documentInformation;
private Context _context;
private Uri _documentPath;

private ArrayList<ILoadingListener> listeners;

public DocumentParser(DocumentInformation information, Context context, Uri documentPath, ILoadingListener listener){

    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");

    listeners = new ArrayList<>();
    listeners.add(listener);

    _document = new XWPFDocument();
    _documentInformation = information;
    _context = context;
    _documentPath = documentPath;
}


private void create(Context context){
    try{
        ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(_documentPath, "w");
        FileOutputStream out = new FileOutputStream(pfd.getFileDescriptor());
        createTitlePage(context);

        _document.write(out); // WHERE THE APP PROBABLY CRASHES
        out.close();

        mailDocuments(context);
    } catch (Exception e){
        Log.e("outputstream", e.toString());
        updateLoadingMessage(e.toString());
    }
}

Thanks for the help in advance!

crash in createHelper.createHyperlink(Hyperlink.LINK_URL)

Hi,
First of all, thanks for sharing!
I'm able to use your poishadow-all.jar ver 0.5 to create nice excel files..
Unfortunately I'm getting the following crash when executing the instruction line:
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
Stack trace:
08-06 17:23:50.438 17495-19724/? W/System.err: java.lang.ClassCastException: org.apache.xmlbeans.impl.g.au cannot be cast to org.openxmlformats.schemas.spreadsheetml.x2006.main.u
08-06 17:23:50.438 17495-19724/? W/System.err: at org.openxmlformats.schemas.spreadsheetml.x2006.main.u$a.a(Unknown Source)
08-06 17:23:50.438 17495-19724/? W/System.err: at org.apache.a.h.b.y.(SourceFile:60)
08-06 17:23:50.438 17495-19724/? W/System.err: at org.apache.a.h.b.y.(SourceFile:49)
08-06 17:23:50.439 17495-19724/? W/System.err: at org.apache.a.h.b.o.b(SourceFile:69)
08-06 17:23:50.439 17495-19724/? W/System.err: at org.apache.a.h.b.o.a(SourceFile:26)

the relevant code for creating the hyperlink in a cell:
CreationHelper createHelper = workbook.getCreationHelper();
cell.setCellValue("click here");
Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
link.setAddress("https://www.google.com");
cell.setHyperlink(link);

Thanks

java.lang.ExceptionInInitializerError

Hi

While importing an .xls or .xlsx file into my project, I get this error. My code is as follows -
Workbook workbook; InputStream fis = mContext.get().getContentResolver().openInputStream(uri); workbook = WorkbookFactory.create(fis);

Logs -

Caused by: java.lang.ExceptionInInitializerError at org.apache.poi.d.b.dc.a(SourceFile:489) at org.apache.poi.d.c.ay.<init>(SourceFile:356) at org.apache.poi.ss.usermodel.WorkbookFactory.create(SourceFile:101) at org.apache.poi.ss.usermodel.WorkbookFactory.create(SourceFile:186) at org.apache.poi.ss.usermodel.WorkbookFactory.create(SourceFile:148) at vivekagarwal.playwithdb.p.a(SourceFile:88) at vivekagarwal.playwithdb.p.a(SourceFile:73) at vivekagarwal.playwithdb.p.doInBackground(SourceFile:38) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)  at java.lang.Thread.run(Thread.java:764)  Caused by: org.apache.poi.i.ac: Unable to determine record types at org.apache.poi.d.b.dc.a(SourceFile:446) at org.apache.poi.d.b.dc.<clinit>(SourceFile:292) at org.apache.poi.d.b.dc.a(SourceFile:489)  at org.apache.poi.d.c.ay.<init>(SourceFile:356)  at org.apache.poi.ss.usermodel.WorkbookFactory.create(SourceFile:101)  at org.apache.poi.ss.usermodel.WorkbookFactory.create(SourceFile:186)  at org.apache.poi.ss.usermodel.WorkbookFactory.create(SourceFile:148)  at vivekagarwal.playwithdb.p.a(SourceFile:88)  at vivekagarwal.playwithdb.p.a(SourceFile:73)  at vivekagarwal.playwithdb.p.doInBackground(SourceFile:38)  at android.os.AsyncTask$2.call(AsyncTask.java:333)  at java.util.concurrent.FutureTask.run(FutureTask.java:266)  at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)  at java.lang.Thread.run(Thread.java:764) 

This works perfectly fine in Debug build i.e. without proguard. I think I need to mention -keep for some class , but cant figure out which 1.

I have added following lines in proguard so that these classes are not obfuscated by proguard and stays intact.

`-dontwarn org.apache.**
-dontwarn org.openxmlformats.schemas.**
-dontwarn org.etsi.**
-dontwarn org.w3.**
-dontwarn com.microsoft.schemas.**
-dontwarn com.graphbuilder.**
-dontnote org.apache.**
-dontnote org.openxmlformats.schemas.**
-dontnote org.etsi.**
-dontnote org.w3.**
-dontnote com.microsoft.schemas.**
-dontnote com.graphbuilder.**

-keeppackagenames org.apache.poi.ss.formula.function

-keep class com.fasterxml.aalto.stax.InputFactoryImpl
-keep class com.fasterxml.aalto.stax.OutputFactoryImpl
-keep class com.fasterxml.aalto.stax.EventFactoryImpl

-keep class schemaorg_apache_xmlbeans.system.sF1327CCA741569E70F9CA8C9AF9B44B2.TypeSystemHolder { public final static *** typeSystem; }

-keep class org.apache.xmlbeans.impl.** { ; }
-keep class org.openxmlformats.schemas.spreadsheetml.x2006.main.
* { ;}
-keep class org.apache.poi.ss.
* { *;}

-keep class org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl.CTPropertiesImpl { *; }
-keep class org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl.PropertiesDocumentImpl { *; }
-keep class org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl.CTPropertiesImpl { *; }
-keep class org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl.PropertiesDocumentImpl { *; }
-keep class org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl.CTDrawingImpl { *; }
-keep class org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl.CTMarkerImpl { *; }
-keep class com.microsoft.schemas.office.office.impl.CTIdMapImpl { *; }
-keep class com.microsoft.schemas.office.office.impl.CTShapeLayoutImpl { *; }
-keep class com.microsoft.schemas.vml.impl.CTShadowImpl { *; }
-keep class com.microsoft.schemas.vml.impl.CTFillImpl { *; }
-keep class com.microsoft.schemas.vml.impl.CTPathImpl { *; }
-keep class com.microsoft.schemas.vml.impl.CTShapeImpl { *; }
-keep class com.microsoft.schemas.vml.impl.CTShapetypeImpl { *; }
-keep class com.microsoft.schemas.vml.impl.CTStrokeImpl { *; }
-keep class com.microsoft.schemas.vml.impl.CTTextboxImpl { *; }
-keep class com.microsoft.schemas.office.excel.impl.CTClientDataImpl { *; }
-keep class com.microsoft.schemas.office.excel.impl.STTrueFalseBlankImpl { *; }`
Can you help?

Error:Execution failed for task

Hello @centic9,
Thanks For such great library.
I am integrating it in android application, At the time of build it will not giving any error, But When i run my app the below exception is getting. I am not able to run my app. Please help me. Thanks in advance.

I am using jar file and version is latest one.

Error:Execution failed for task ':app:transformClassesWithNewClassShrinkerForDebug'.

com.android.build.gradle.shrinker.ClassLookupException: Invalid class reference: javax/xml/crypto/KeySelector

Error when build project

I have a problem when building the source

More than one file was found with OS independent path 'schemaorg_apache_xmlbeans/system/sF1327CCA741569E70F9CA8C9AF9B44B2/ctpivotsourcecb49type.xsb'

Could you help me?

Not working.

You wrote:

Getting started
Use a pre-built jar
If you want to get started quickly, there is a ready-made jar-file available in the release section.
You should be able to simply add this to your Android project and use the Apache POI classes from it.

I added the "poisahdow-all,jar" file to an empty test project. And I tried to just refer to the class from this library:

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView message = (TextView)findViewById(R.id.messageTV);
        try {
            Workbook wb = new XSSFWorkbook();
            message.setText("The book instance was created.");
        }
        catch (Exception ex){
            message.setText(ex.getMessage());
        }        
    }
}

The contents of the "build.gradle" file are standard with the option enabled multiDexEnabled = ture:
When I try to run this application, the compilation runs successfully. But when you run this application and when you try to create an instance of a WorkBook in this row:
try { Workbook wb = new XSSFWorkbook(); }
That application is closed with the message:
10
And the exception is not intercepted by try-catch block and it is unclear for what reason this occurs.
Tell me please, what am I doing wrong? Why does not this library want to work on android?

Caused by: java.io.IOException: Failed to read zip entry source

I run your poitest app. And get this::

03-09 10:08:43.641 24947-24947/org.dstadler.poiandroidtest.poitest E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.dstadler.poiandroidtest.poitest, PID: 24947
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.dstadler.poiandroidtest.poitest/org.dstadler.poiandroidtest.poitest.DocumentListActivity}: java.lang.IllegalStateException: java.io.IOException: Failed to read zip entry source
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5264)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
Caused by: java.lang.IllegalStateException: java.io.IOException: Failed to read zip entry source
at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:119)
at android.app.Activity.performCreate(Activity.java:5975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:147) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5264) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695) 
Caused by: java.io.IOException: Failed to read zip entry source
at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:103)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
at org.apache.poi.xwpf.usermodel.XWPFDocument.(XWPFDocument.java:116)
at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:106)
at android.app.Activity.performCreate(Activity.java:5975) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:147) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5264) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695) 
Caused by: java.util.zip.ZipException: invalid distance too far back
at java.util.zip.ZipInputStream.read(ZipInputStream.java:339)
at org.apache.poi.openxml4j.util.ZipSecureFile$ThresholdInputStream.read(ZipSecureFile.java:219)
at java.io.InputStream.read(InputStream.java:162)
at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.(ZipInputStreamZipEntrySource.java:132)
at org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.(ZipInputStreamZipEntrySource.java:56)
at org.apache.poi.openxml4j.opc.ZipPackage.(ZipPackage.java:100)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324) 
at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37) 
at org.apache.poi.xwpf.usermodel.XWPFDocument.(XWPFDocument.java:116) 
at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:106) 
at android.app.Activity.performCreate(Activity.java:5975) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:147) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5264) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695) 

Error from this code :

InputStream docFile = getResources().openRawResource(R.raw.lorem_ipsum);
try {
XWPFDocument doc = new XWPFDocument(docFile);
try {
for(XWPFParagraph paragraph : doc.getParagraphs()) {
DummyContent.addItem(new DummyContent.DummyItem(Integer.toString(i), StringUtils.abbreviate(paragraph.getText(), 20), paragraph.getText()));
i++;
}
} finally {
doc.close();
}
} finally {
docFile.close();
}
in DocumentListActivity.Java File

Seem cant read InputStream from your "lorem_ipsum" raw
Please help me fix this issue. Thanks for your help

Not working with Instant Run Option

In Android Studio, the default setting is to have instant run (Preferences -> Build, Exec. & Deployment -> Instant Run) turned on. However, it seems like by adding the shadow jar file, the app cannot run on my device. It is only after I turn off the instant run feature that my app runs with the shadow jar.

Is there a way to still have instant run mode on, without breaking the build?

EDIT: Also, thanks for making this! I tried using another similar library (here) but to my knowledge that one didn't work for all gradle build versions, and I had a app:transformClassesWithDexForDebug error with it. Yours works though (provided that I turn "instant run" off).

APK Size Matters

Does the inclusion of poi on android results in larger apk size?
As the apache poi itself has a size of 20-30Mb.

Cannot create XWPFTable in XWPFDocument document

Hello, I make Android application with possibility to create docx file with text and table in it. For creating a file with table I use the next code:

 val fileOutPutStream =
                FileOutputStream(File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path + "/mytable.docx"))

            val document = XWPFDocument()
            val tableOne = document.createTable(2, 2)
            tableOne.getRow(0).getCell(0).text = "1"
            tableOne.getRow(0).getCell(1).text = "2"
            tableOne.getRow(1).getCell(0).text = "3"
            tableOne.getRow(1).getCell(1).text = "4"

            document.write(fileOutPutStream)
            fileOutPutStream.close()
            document.close()

And file is created well. But when I open it, I see only texts without tables. Here is screenshot of document:

1

What I make wrong? How to fix this? Thanks.

support poi 4.0

Adding for planning purposes since queries have come in POI user list about this

Provider com.fasterxml.aalto.stax.EventFactoryImpl not found when use android:sharedUserId

Good afternoon. I built your test project with the poishadow-all.jar library and it works great. But if I add in AndroidManifest.xml android: sharedUserId = "org.dstadler.poiandroidtest.poitest" to the 4th line - an error occurs:

05-04 15:29:38.758 8690-8690/org.dstadler.poiandroidtest.poitest E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.dstadler.poiandroidtest.poitest, PID: 8690
org.apache.poi.javax.xml.stream.FactoryConfigurationError: Provider com.fasterxml.aalto.stax.EventFactoryImpl 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:120)
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:480)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:247)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:239)
at org.dstadler.poiandroidtest.poitest.DocumentListActivity.writeWorkbook(DocumentListActivity.java:171)
at org.dstadler.poiandroidtest.poitest.DocumentListActivity.onCreate(DocumentListActivity.java:71)
at android.app.Activity.performCreate(Activity.java:6955)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1642)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)

Is it possible to fix this error?

java.lang.VerifyError: org/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl

I try to create an excel file with your library, it works with android> 5 but I get this error under Kiktat (API 19). Here is my code and stacktrace. By the way, do you know how to change the size of a column automatically?

private void writeGames() {
    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.workbook = new XSSFWorkbook();
    for (int idGame : games) {
        idActualGame = idGame;
        nbPlayers = Data.bdd.get_nb_joueur(idActualGame);
        initialiseFile();
        writeHeading();
        List<Integer> round = Data.bdd.loadGame(idActualGame);

        for (int actualRound : round) {
            writeScoreRound(actualRound);
        }

        writeTotal();
        //autoSizeColum(0,6);
        saveFile();
    }
}

Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCustomWorkbookViews', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewCustomWorkbookViews
W/dalvikvm: VFY: unable to resolve check-cast 6520 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTCustomWorkbookViews;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtensionList', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewExtLst
W/dalvikvm: VFY: unable to resolve check-cast 6541 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileRecoveryPr', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewFileRecoveryPr
W/dalvikvm: VFY: unable to resolve check-cast 6558 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileSharing', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewFileSharing
W/dalvikvm: VFY: unable to resolve check-cast 6559 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileSharing;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileVersion', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewFileVersion
W/dalvikvm: VFY: unable to resolve check-cast 6560 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileVersion;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFunctionGroups', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewFunctionGroups
W/dalvikvm: VFY: unable to resolve check-cast 6574 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFunctionGroups;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTOleSize', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewOleSize
W/dalvikvm: VFY: unable to resolve check-cast 6608 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTOleSize;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSmartTagPr', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewSmartTagPr
W/dalvikvm: VFY: unable to resolve check-cast 6669 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTSmartTagPr;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSmartTagTypes', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewSmartTagTypes
W/dalvikvm: VFY: unable to resolve check-cast 6670 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTSmartTagTypes;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWebPublishObjects', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewWebPublishObjects
W/dalvikvm: VFY: unable to resolve check-cast 6691 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTWebPublishObjects;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWebPublishing', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.addNewWebPublishing
W/dalvikvm: VFY: unable to resolve check-cast 6692 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTWebPublishing;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCustomWorkbookViews', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getCustomWorkbookViews
W/dalvikvm: VFY: unable to resolve check-cast 6520 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTCustomWorkbookViews;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtensionList', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getExtLst
W/dalvikvm: VFY: unable to resolve check-cast 6541 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileRecoveryPr', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getFileRecoveryPrArray
W/dalvikvm: VFY: unable to resolve check-cast 6558 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileRecoveryPr[]', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getFileRecoveryPrArray
W/dalvikvm: VFY: unable to resolve new-array 8352 ([Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x23 at 0x001a
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl$1FileRecoveryPrList', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getFileRecoveryPrList
W/dalvikvm: VFY: unable to resolve new-instance 6929 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl$1FileRecoveryPrList;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x22 at 0x0008
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileSharing', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getFileSharing
W/dalvikvm: VFY: unable to resolve check-cast 6559 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileSharing;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileVersion', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getFileVersion
W/dalvikvm: VFY: unable to resolve check-cast 6560 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileVersion;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFunctionGroups', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getFunctionGroups
W/dalvikvm: VFY: unable to resolve check-cast 6574 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFunctionGroups;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTOleSize', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getOleSize
W/dalvikvm: VFY: unable to resolve check-cast 6608 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTOleSize;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSmartTagPr', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getSmartTagPr
W/dalvikvm: VFY: unable to resolve check-cast 6669 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTSmartTagPr;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
D/dalvikvm: GC_FOR_ALLOC freed 1437K, 7% free 23867K/25428K, paused 14ms, total 14ms
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSmartTagTypes', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getSmartTagTypes
W/dalvikvm: VFY: unable to resolve check-cast 6670 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTSmartTagTypes;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWebPublishObjects', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getWebPublishObjects
W/dalvikvm: VFY: unable to resolve check-cast 6691 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTWebPublishObjects;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWebPublishing', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.getWebPublishing
W/dalvikvm: VFY: unable to resolve check-cast 6692 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTWebPublishing;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileRecoveryPr', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.insertNewFileRecoveryPr
W/dalvikvm: VFY: unable to resolve check-cast 6558 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
W/dalvikvm: VFY: unable to find class referenced in signature (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTCustomWorkbookViews;)
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCustomWorkbookViews', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.setCustomWorkbookViews
W/dalvikvm: VFY: unable to resolve check-cast 6520 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTCustomWorkbookViews;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
W/dalvikvm: VFY: unable to find class referenced in signature (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList;)
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtensionList', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.setExtLst
W/dalvikvm: VFY: unable to resolve check-cast 6541 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0013
W/dalvikvm: VFY: unable to find class referenced in signature (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;)
E/dalvikvm: Could not find class 'org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFileRecoveryPr', referenced from method org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTWorkbookImpl.setFileRecoveryPrArray
W/dalvikvm: VFY: unable to resolve check-cast 6558 (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;) in Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
D/dalvikvm: VFY: replacing opcode 0x1f at 0x0012
W/dalvikvm: VFY: unable to find class referenced in signature ([Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;)
W/dalvikvm: VFY: [Ljava/lang/Object; is not instance of [Lorg/apache/xmlbeans/XmlObject;
W/dalvikvm: VFY: bad arg 1 (into [Lorg/apache/xmlbeans/XmlObject;)
W/dalvikvm: VFY: rejecting call to Lorg/apache/xmlbeans/impl/values/XmlComplexContentImpl;.arraySetterHelper ([Lorg/apache/xmlbeans/XmlObject;Lorg/apache/poi/javax/xml/namespace/QName;)V
W/dalvikvm: VFY: rejecting opcode 0x6e at 0x000a
W/dalvikvm: VFY: rejected Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;.setFileRecoveryPrArray ([Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/CTFileRecoveryPr;)V
W/dalvikvm: Verifier rejected class Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;
W/dalvikvm: Class init failed in Constructor.constructNative (Lorg/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl;)
W/dalvikvm: threadid=28: thread exiting with uncaught exception (group=0x9cd8ab20)

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
blabla, it's my function
Caused by: java.lang.VerifyError: org/openxmlformats/schemas/spreadsheetml/x2006/main/impl/CTWorkbookImpl
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createUnattachedNode(SchemaTypeImpl.java:1934)
at org.apache.xmlbeans.impl.schema.SchemaTypeImpl.createTypeStoreUser(SchemaTypeImpl.java:1880)
at org.apache.xmlbeans.impl.store.Xobj.setStableType(Xobj.java:1408)
at org.apache.xmlbeans.impl.store.Cur.setType(Cur.java:2502)
at org.apache.xmlbeans.impl.store.Cur.setType(Cur.java:2487)
at org.apache.xmlbeans.impl.store.Locale.newInstance(Locale.java:637)
at org.apache.xmlbeans.impl.store.Locale.newInstance(Locale.java:613)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.newInstance(SchemaTypeLoaderBase.java:198)
at org.apache.poi.POIXMLTypeLoader.newInstance(POIXMLTypeLoader.java:112)
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown Source)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:451)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:248)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:239)
at writeGames(WriteToExcel.java:115)
at WriteToExcel.access$200(WriteToExcel.java:44)
at WriteToExcel$AsyncTaskRunner.doInBackground(WriteToExcel.java:362)
at WriteToExcel$AsyncTaskRunner.doInBackground(WriteToExcel.java:356)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841) 

Any screenshot of errors from above (more readable)
image
image

java.lang.NoClassDefFoundError

Hello. We spoke with you on this thread http://apache-poi.1045710.n5.nabble.com/Android-Proguard-Apache-POI-tc5727688.html. I added in project:

    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");

At first in MainActivity.onCreate then tried to add in IntentService onHandleIntent, but I get the error :
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/font/FontRenderContext;
at org.apache.a.e.d.k.(SourceFile:110)
at org.apache.a.g.b.a.(SourceFile:117)
at org.apache.a.g.b.f.(SourceFile:79)
at org.apache.a.g.b.g.b(SourceFile:652)
at org.apache.a.g.b.g.a(SourceFile:673)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.