andruhon/android5xlsx

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

Closed this issue · 4 comments

Hi.

After serverals times trying to implement a class to create XLSX on my tablet, I 've founded your repository.

When i Try to do this on AsyncTask

(...)
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

(..)
protected String doInBackground(String... peticion) {
** XSSFWorkbook wb = new XSSFWorkbook();**
(...)

It returns this exception:

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:417)
                                                                     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.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook$Factory.newInstance(Unknown Source)
                                                                     at org.apache.poi.xssf.usermodel.XSSFWorkbook.onWorkbookCreate(XSSFWorkbook.java:407)
                                                                     at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:219)
                                                                     at com.asde.armatest.persistency.AsyncExcelFile.doInBackground(AsyncExcelFile.java:284)
                                                                     at com.asde.armatest.persistency.AsyncExcelFile.doInBackground(AsyncExcelFile.java:34)

This is my Gradle config

 defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 14
        targetSdkVersion 19

        multiDexEnabled true

    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt')
            proguardFile 'D:/Path/app/proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:multidex:1.0.1'
    //compile files('libs/android-support-v13.jar')
    compile files('libs/commons-io-2.4.jar')
    compile files('libs/commons-net-3.3.jar')
    compile files('libs/poi-3.12-android-a.jar')
    compile files('libs/poi-ooxml-schemas-3.12-20150511-a.jar')
    compile 'com.roomorama:caldroid:2.3.1'

}

What would be wrong? Thanks a lot

Android Version 4.1.2
Java 1.8

Unfortunately this libs are for Android>=5. It won't work with Android 4 because multi-dex on Android 4 works a bit differently from Android 5. You can try this one: https://github.com/andruhon/AndroidReadXLSX (It's quite limited, so read Readme first to know workarounds)

Thanks.

This version for Android 4 works properly on Android 5?
Can I use both libraries in the same app and select each depending on Android version?

Version for Android 4 will certainly work on Android 5, so, if it's functionality is sufficient you can use this one for both versions. I don't think that it is feasible to have both of them in the same app, they generally contain same classes which will cause namespace conflict.

Hi andruhon, this version for Android 4 works like a charm, maybe a bit slow but I think that it is due to the xlsx format and my 500 columns :p. For my needs it is sufficient. Thanks a lot. You save my week!