环境:Android API 25, Java1.8
Jar:aspose-words-23.12.0-android.via.java.jar
我把Jar复制到了Android工程libs目录中,同时配置好了build文件:
implementation files(‘libs/aspose-words-23.12.0-android.via.java.jar’)
程序是这样写的:
Document doc=new Document(rootDir+“API.docx”); //1
doc.save(rootDir+“1.pdf”); //2
其中rootDir是有权限的,已经获取了目录权限,和读写权限。
执行Document的构造方法的时候就报错了如下, 请帮助看看是什么问题。
备注:Windows模拟器和小米手机都测试了,都是一样的在Document构造方法就报错了。
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.dazhousoft.asposetest, PID: 22718
java.lang.IllegalStateException: Could not execute method for android:onClick
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:414)
at android.view.View.performClick(View.java:5637)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:409)
at android.view.View.performClick(View.java:5637)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: com.aspose.words.internal.zzZ0R: Exception on self test: length=32; index=32: EC
at com.aspose.words.internal.zzYZK.zzZ(Unknown Source)
at com.aspose.words.internal.zzZ1L.zzZ(Unknown Source)
at com.aspose.words.internal.zzZ1L.(Unknown Source)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:400)
at java.lang.Class.forName(Class.java:326)
at com.aspose.words.internal.zzZ0P.zzwJ(Unknown Source)
at com.aspose.words.internal.zzZ0P.zzwH(Unknown Source)
at com.aspose.words.internal.zzZ0P$zzZ.run(Unknown Source)
at com.aspose.words.internal.zzZ0P.isReady(Unknown Source)
at com.aspose.words.internal.zzZ1P$zzY.(Unknown Source)
at com.aspose.words.internal.zzZ1P$zzZ.zzZ(Unknown Source)
at com.aspose.words.internal.zzS1.(Unknown Source)
at com.aspose.words.internal.zzS1.zzYv(Unknown Source)
at com.aspose.words.internal.zzXC.(Unknown Source)
at com.aspose.words.internal.zzXC.(Unknown Source)
at com.aspose.words.internal.zzXC.(Unknown Source)
at com.aspose.words.internal.zzIM.zz3(Unknown Source)
at com.aspose.words.zzYV9.zzY0(Unknown Source)
at com.aspose.words.zzZXO.zzZ(Unknown Source)
at com.aspose.words.zzZXO.zzNN(Unknown Source)
at com.aspose.words.zz7Q.zz8(Unknown Source)
at com.aspose.words.zz7Q.zzZBB(Unknown Source)
at com.aspose.words.zz7Q.zzZBM(Unknown Source)
at com.aspose.words.zz7Q.zzb(Unknown Source)
at com.aspose.words.zz3P.zzZwZ(Unknown Source)
at com.aspose.words.zz3P.zzZx0(Unknown Source)
at com.aspose.words.zz3P.zzF(Unknown Source)
at com.aspose.words.zz72.zzZAQ(Unknown Source)
at com.aspose.words.zz72.zzZAR(Unknown Source)
at com.aspose.words.zz72.zz7(Unknown Source)
at com.aspose.words.zz8D.zzXh(Unknown Source)
at com.aspose.words.zz8D.zzJ1(Unknown Source)
at com.aspose.words.zz8D.zzs(Unknown Source)
at com.aspose.words.zzZXO.zzZmK(Unknown Source)
at com.aspose.words.zzYUL.zzE(Unknown Source)
at com.aspose.words.zzYUL.zzL(Unknown Source)
at com.aspose.words.zzYUL.zzX(Unknown Source)
at com.aspose.words.zzYUL.zzO(Unknown Source)
at com.aspose.words.zzYUL.zzW(Unknown Source)
at com.aspose.words.zzZX5.zzX(Unknown Source)
at com.aspose.words.zzYUZ.zzF(Unknown Source)
at com.aspose.words.zzZWV.zzL(Unknown Source)
at com.aspose.words.zzZWC.zzF(Unknown Source)
at com.aspose.words.zzZWC.zzG(Unknown Source)
at com.aspose.words.zzYV9.zzQ(Unknown Source)
at com.aspose.words.zz1N.zzZv3(Unknown Source)
at com.aspose.words.zz1N.zzZv4(Unknown Source)
at com.aspose.words.zz1N.zzZx0(Unknown Source)
at com.aspose.words.zz1N.zzF(Unknown Source)
at com.aspose.words.zzBE.zzZ(Unknown Source)
at com.aspose.words.zzBE.zzY(Unknown Source)
at com.aspose.words.zzBE.zzw(Unknown Source)
at com.aspose.words.zz72.zzZAQ(Unknown Source)
at com.aspose.words.zz72.zzZAR(Unknown Source)
at com.aspose.words.zz72.zz7(Unknown Source)
at com.aspose.words.zz8D.zzXh(Unknown Source)
at com.aspose.words.zz8D.zzJ1(Unknown Source)
at com.aspose.words.zz8D.zzs(Unknown Source)
at com.aspose.words.zzZXO.zzZmK(Unknown Source)
at com.aspose.words.zzYUL.zzE(Unknown Source)
at com.aspose.words.zzYUL.zzL(Unknown Source)
at com.aspose.words.zzYUL.zzX(Unknown Source)
at com.aspose.words.zzYUL.zzA(Unknown Source)
at com.aspose.words.zzYUL.zzB(Unknown Source)
at com.aspose.words.zzYUL.zzX(Unknown Source)
at com.aspose.words.zzYUL.zzO(Unknown Source)
at com.aspose.words.zzYUL.zzW(Unknown Source)
at com.aspose.words.zzZX5.zzX(Unknown Source)
at com.aspose.words.zzYUZ.zzF(Unknown Source)
at com.aspose.words.zzZWV.zzL(Unknown Source)
at com.aspose.words.zzZWC.zzF(Unknown Source)
at com.aspose.words.zzZXO.zzL(Unknown Source)
at com.aspose.words.zzZXP.zzZmX(Unknown Source)
at com.aspose.words.zzZXP.zzZmY(Unknown Source)
at com.aspose.words.zzZXO.zzIw(Unknown Source)
at com.aspose.words.zzZWS.zzZlD(Unknown Source)
at com.aspose.words.zzZWS.zzIw(Unknown Source)
at com.aspose.words.zzYNP.zzIw(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.dazhousoft.asposetest.MainActivity.OnClick(MainActivity.java:76)
… 12 more