我在Android版本4中遇到错误
E/ExcelSheet: null
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
at org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:456)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:162)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:271)
at com.example.vinove.excelsheetapp.Poi.ExcelSheet.readExcelSheet(ExcelSheet.java:63)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:137)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:107)
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)
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:60)
at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:456)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:162)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:271)
at com.example.vinove.excelsheetapp.Poi.ExcelSheet.readExcelSheet(ExcelSheet.java:63)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:137)
at com.example.vinove.excelsheetapp.Activities.MainActivity$MyTask.doInBackground(MainActivity.java:107)
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)
Caused by: java.lang.NoClassDefFoundError: org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory
at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:46)
at java.lang.reflect.Constructor.constructNative(Native Method)
答案 0 :(得分:2)
Apache POI在Android上无法正常使用,您将遇到各种问题。
有些项目可以在Android上使用部分Apache POI: