centic9 / poi-on-android

A sample project that shows how Apache POI can be used in an Android application
Apache License 2.0
357 stars 89 forks source link

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

Closed filol closed 6 years ago

filol commented 7 years ago

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

alexbusuioc commented 7 years ago

I'm also getting this error for Android 4. Did you find a solution?

filol commented 7 years ago

No, but i you find, i'm interested

centic9 commented 6 years ago

Please try to include the full ooxml-schemas-jar as described at http://poi.apache.org/faq.html#faq-N10025, any missing classes should be added to poi-ooxml-schemas directly, I have updated the included classes somewhat for Apache POI 4.0.0.