我在使用我的应用程序与org.apache.poi.POIXMLException合并后运行我的模块时遇到此异常:java.lang.reflect.InvocationTargetException
OPCPackage pkg = OPCPackage.open(temp);
XSSFWorkbook workbook = new XSSFWorkbook(pkg);
numberOfSheet = workbook.getNumberOfSheets();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
XSSFSheet sheet = workbook.getSheetAt(i);
int rowsCount = sheet.getPhysicalNumberOfRows();
FormulaEvaluator formulaEvaluator= workbook.getCreationHelper().createFormulaEvaluator();
for (int r = 0; r < rowsCount; r++) {
Row row = sheet.getRow(r);
int cellsCount = row.getPhysicalNumberOfCells();
for (int c = 0; c < cellsCount; c++) {
String value = getCellAsString(row, c, formulaEvaluator);
al.add(new ExcelValues(i, r, c, value));
}
}
}
这在Android 5.0及更新版本中运行完美,并且在单独的应用程序中也是如此。
这是我得到的致命错误消息
java.lang.NoClassDefFoundError: org.dom4j.Namespace
at org.apache.poi.openxml4j.opc.internal.unmarshallers.PackagePropertiesUnmarshaller.<clinit>(PackagePropertiesUnmarshaller.java:49)
at org.apache.poi.openxml4j.opc.OPCPackage.init(OPCPackage.java:154)
at org.apache.poi.openxml4j.opc.OPCPackage.<init>(OPCPackage.java:141)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:37)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:127)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:251)
at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:200)
at idzyns.alburraq.amltraining.utils.ExcelValues.onRead(ExcelValues.java:137)
at idzyns.alburraq.amltraining.CreateEventActivity.onActivityResult(CreateEventActivity.java:355)
at android.app.Activity.dispatchActivityResult(Activity.java:5456)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3549)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3596)
at android.app.ActivityThread.access$1300(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1369)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
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:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)