在Android Studio中集成POI以读取PPTx

时间:2018-05-14 13:15:25

标签: android apache-poi

我正在整合POI来阅读PPTx,我正在使用以下jar,我已经尝试了大部分的jar。所以请告诉我在android studio中集成POI以正确阅读PPTx的方法。我不知道我收到此错误的原因。

implementation files('libs/poi-ooxml-3.9.jar')
implementation files('libs/poi-3.9.jar')
implementation files('libs/xmlbeans-2.6.0.jar')
implementation files('libs/dom4j-1.6.1.jar')
implementation files('libs/commons-collections4-4.1.jar')
implementation files('libs/commons-codec-1.10.jar')
implementation files('libs/poi-scratchpad-3.9.jar')

并收到此错误。

org.apache.poi.POIXMLException: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
        at org.apache.poi.xslf.usermodel.XMLSlideShow.<init>(XMLSlideShow.java:82)
        at org.apache.poi.xslf.usermodel.XMLSlideShow.<init>(XMLSlideShow.java:87)
        at com.pptviewer.pptfilereader.MainActivity.openppt(MainActivity.java:137)
        at com.pptviewer.pptfilereader.MainActivity.access$600(MainActivity.java:43)
        at com.pptviewer.pptfilereader.MainActivity$ConvertPPTXTOPNG.onPostExecute(MainActivity.java:128)
        at com.pptviewer.pptfilereader.MainActivity$ConvertPPTXTOPNG.onPostExecute(MainActivity.java:116)
        at android.os.AsyncTask.finish(AsyncTask.java:667)
        at android.os.AsyncTask.-wrap1(AsyncTask.java)
        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
05-14 18:28:32.444 15297-15297/com.pptviewer.pptfilereader W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6349)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783)
    Caused by: org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
        at org.apache.poi.xslf.usermodel.XSLFFactory.createDocumentPart(XSLFFactory.java:66)
        at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:403)
        at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:155)
        at org.apache.poi.xslf.usermodel.XMLSlideShow.<init>(XMLSlideShow.java:80)
        ... 14 more
05-14 18:28:32.445 15297-15297/com.pptviewer.pptfilereader W/System.err: Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
        at org.apache.poi.xslf.usermodel.XSLFFactory.createDocumentPart(XSLFFactory.java:64)
        ... 17 more
    Caused by: java.lang.NoClassDefFoundError
        at org.apache.xmlbeans.XmlBeans.class$(XmlBeans.java:43)
        at org.apache.xmlbeans.XmlBeans.buildStreamToNodeMethod(XmlBeans.java:247)
        at org.apache.xmlbeans.XmlBeans.<clinit>(XmlBeans.java:134)
        at org.apache.xmlbeans.XmlBeans.getContextTypeLoader(XmlBeans.java:327)
        at org.openxmlformats.schemas.presentationml.x2006.main.SldMasterDocument$Factory.parse(Unknown Source)
        at org.apache.poi.xslf.usermodel.XSLFSlideMaster.<init>(XSLFSlideMaster.java:68)
        ... 20 more
05-14 18:28:32.446 15297-15297/com.pptviewer.pptfilereader W/System.err: Caused by: java.lang.ClassNotFoundException: javax.xml.stream.XMLStreamReader
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:400)
        at java.lang.Class.forName(Class.java:326)
        ... 26 more
    Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.stream.XMLStreamReader" on path: DexPathList[[zip file "/data/app/com.pptviewer.pptfilereader-1/base.apk"],nativeLibraryDirectories=[/data/app/com.pptviewer.pptfilereader-1/lib/arm, /data/app/com.pptviewer.pptfilereader-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
05-14 18:28:32.447 15297-15297/com.pptviewer.pptfilereader W/System.err:    ... 29 more

0 个答案:

没有答案