第三方jar引用Character.UnicodeScript,androi.jar和jdk都有这个方法,理论上,第三方jar应该使用的是jdk里的Character.UnicodeScript,但我在studio中使用第三方jar时,可能调用了android.jar里的Character.UnicodeScript。在运行的时候报错java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/Character$UnicodeScript;
具体报错如下:
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/Character$UnicodeScript;
at com.itextpdf.layout.renderer.TextRenderer.applyOtf(TextRenderer.java:607)
at com.itextpdf.layout.renderer.LineRenderer.applyOtf(LineRenderer.java:1240)
at com.itextpdf.layout.renderer.LineRenderer.layout(LineRenderer.java:162)
at com.itextpdf.layout.renderer.ParagraphRenderer.directLayout(ParagraphRenderer.java:225)
at com.itextpdf.layout.renderer.ParagraphRenderer.layout(ParagraphRenderer.java:110)
at com.itextpdf.layout.renderer.RootRenderer.addChild(RootRenderer.java:136)
at com.itextpdf.layout.RootElement.createAndAddRendererSubTree(RootElement.java:377)
at com.itextpdf.layout.RootElement.add(RootElement.java:106)
at com.itextpdf.layout.Document.add(Document.java:160)
at com.cq.androidtools.pdf.PDFActivity.onShow(PDFActivity.kt:40)
at com.cq.androidtools.pdf.PDFActivity.onCreate(PDFActivity.kt:22)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.Character$UnicodeScript" on path: DexPathList[[zip file "/data/app/com.cq.androidtools-1/base.apk"],nativeLibraryDirectories=[/data/app/com.cq.androidtools-1/lib/x86, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.itextpdf.layout.renderer.TextRenderer.applyOtf(TextRenderer.java:607)
at com.itextpdf.layout.renderer.LineRenderer.applyOtf(LineRenderer.java:1240)
at com.itextpdf.layout.renderer.LineRenderer.layout(LineRenderer.java:162)
at com.itextpdf.layout.renderer.ParagraphRenderer.directLayout(ParagraphRenderer.java:225)
at com.itextpdf.layout.renderer.ParagraphRenderer.layout(ParagraphRenderer.java:110)
at com.itextpdf.layout.renderer.RootRenderer.addChild(RootRenderer.java:136)
at com.itextpdf.layout.RootElement.createAndAddRendererSubTree(RootElement.java:377)
at com.itextpdf.layout.RootElement.add(RootElement.java:106)
at com.itextpdf.layout.Document.add(Document.java:160)
at com.cq.androidtools.pdf.PDFActivity.onShow(PDFActivity.kt:40)
at com.cq.androidtools.pdf.PDFActivity.onCreate(PDFActivity.kt:22)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Suppressed: java.lang.ClassNotFoundException: java.lang.Character$UnicodeScript
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 25 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
求大佬告知如何解决或者思路,感谢