我在Android应用中使用iTextG。有时我会遇到致命的崩溃:
01-03 14:57:28.226 10662 10662 E AndroidRuntime: java.lang.RuntimeException:
Unable to start activity
ComponentInfo{lin.dipsheetmaker/lin.dipsheetmaker.ViewPDF}:
ExceptionConverter: com.itextpdf.text.DocumentException: No message found for
1.not.found.as.resource
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2955)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
android.app.ActivityThread.-wrap11(Unknown Source:0)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
android.os.Handler.dispatchMessage(Handler.java:105)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
android.os.Looper.loop(Looper.java:164)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
android.app.ActivityThread.main(ActivityThread.java:6938)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
java.lang.reflect.Method.invoke(Native Method)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
01-03 14:57:28.226 10662 10662 E AndroidRuntime: Caused by:
ExceptionConverter:
com.itextpdf.text.DocumentException: No message found for
1.not.found.as.resource
01-03 14:57:28.226 10662 10662 E AndroidRuntime: Caused by:
com.itextpdf.text.DocumentException: No message found for
1.not.found.as.resource
它将指向我的代码中的这一行:
Paragraph dip_sheet_title = new Paragraph(15, "UTILITY STRUCTURE AS-BUILT SHEET", FontFactory.getFont(FontFactory.HELVETICA, sheet_title_font_size, Font.BOLD, new BaseColor(0, 0, 0)));
我发现了类似的问题(Why do I get a message saying 1.not.found.as.a.resource?),但是我不确定如何弄乱罐子。我在应用程序中包括iTextG的唯一方法是在build.gradle中包括以下行:
implementation 'com.itextpdf:itextg:5.5.10'
我还尝试了清理/重建项目和使缓存无效/重新启动,但是仍然偶尔会发生崩溃。上面问题的答案还提到它可能来自于更改操作系统。我已经在Windows机器和Mac上开发了该应用程序,但是我不确定这怎么可能改变任何东西。