Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/331.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在java代码中解决java.lang.ExceptionInInitializerError错误?_Java_Android_Cordova_Phonegap Plugins - Fatal编程技术网

如何在java代码中解决java.lang.ExceptionInInitializerError错误?

如何在java代码中解决java.lang.ExceptionInInitializerError错误?,java,android,cordova,phonegap-plugins,Java,Android,Cordova,Phonegap Plugins,这一行出现了一个错误,我不明白该怎么说。还有一个我正在使用的库qoppa.jar如何解决这个问题,有人能帮我吗 m_LoadedDoc = new PDFDocument(new FilePDFSource((String) path[0]), PDFViewer.this); java.lang.ExceptionInInitializerError at com.qoppa.android.pdfProcess.PDFDocument$1.b(Unknown

这一行出现了一个错误,我不明白该怎么说。还有一个我正在使用的库qoppa.jar如何解决这个问题,有人能帮我吗

    m_LoadedDoc = new PDFDocument(new FilePDFSource((String) path[0]), PDFViewer.this);




    java.lang.ExceptionInInitializerError
    at com.qoppa.android.pdfProcess.PDFDocument$1.b(Unknown Source)
    at com.qoppa.android.pdfViewer.e.p.b(Unknown Source)
    at com.qoppa.android.pdfProcess.PDFDocument.b(Unknown Source)
    at com.qoppa.android.pdfProcess.PDFDocument.<init>(Unknown Source)
    at com.qoppa.android.pdfProcess.PDFDocument.<init>(Unknown Source)
    at com.pdfplugin.PDFViewer$LoadDocument.doInBackground(PDFViewer.java:469)
m_LoadedDoc=newpdfdocument(newfilepdfsource((String)path[0]),PDFViewer.this);
java.lang.ExceptionInInitializeError
位于com.qoppa.android.pdfProcess.PDFDocument$1.b(未知来源)
访问com.qoppa.android.pdfViewer.e.p.b(未知来源)
位于com.qoppa.android.pdfProcess.PDFDocument.b(未知来源)
位于com.qoppa.android.pdfProcess.PDFDocument。(未知来源)
位于com.qoppa.android.pdfProcess.PDFDocument。(未知来源)
位于com.pdfplugin.PDFViewer$LoadDocument.doInBackground(PDFViewer.java:469)

在阅读文档之前,需要调用一条神奇的线:

//Magic:注册资产管理器以加载字体。
StandardFontTF.mAssetMgr=getContext().getAssets();
//现在您可以阅读文档了。
PDFDocument doc=新的PDFDocument(新文件pdfsource(path),PDFViewer.this);

您可能还需要包含示例项目中的
assets/font
assets/cmap
目录。

是否可以记录路径[0]以查看完整路径?它可能是空的,也可能是文件的相对路径。是的,路径是正确的。到那里来。它是什么?文件存在吗?您是否尝试过使用其他文件?是的,有可用的文件路径,如“/sdcard/sample.pdf”我正在尝试使用。同样的错误也会出现m_LoadedDoc=new PDFDocument(new InputStreamPDFSource((InputStream)path[0]),PDFViewer.this);