我正在尝试使用mupdf库开发pdf阅读器。

它适用于Android版本4.4.2,但不适用于棒棒糖5.0或更高版本。

以下是我面临的错误:

 08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: illegal class name 'android.graphics.PointF'
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]     (should be of the form 'package/Class', [Lpackage/Class;' or '[[B')
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]     in call to FindClass
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]     from void com.artifex.mupdfdemo.MuPDFCore.addMarkupAnnotationInternal(android.graphics.PointF[], int)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65] "AsyncTask #3" prio=5 tid=18 Runnable
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x12d56ee0 self=0xb90bd420
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   | sysTid=8904 nice=10 cgrp=apps/bg_non_interactive sched=0/0 handle=0xb90bd900
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   | state=R schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   | stack=0xa444d000-0xa444f000 stackSize=1036KB
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #00 pc 00004f60  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #01 pc 00003665  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #02 pc 00256ad1  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+84)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #03 pc 00239687  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+158)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #04 pc 000b1a2b  /system/lib/libart.so (art::JniAbort(char const*, char const*)+610)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #05 pc 000b2165  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+68)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #06 pc 000b6197  /system/lib/libart.so (art::CheckJNI::FindClass(_JNIEnv*, char const*)+66)
    08-13 11:37:33.134: A/art(8754): art/runtime/check_jni.cc:65]   native: #07 pc 00024c03  /data/app/jp.co.iti.mymupdfsample-1/lib/arm/libmupdf.so (Java_com_artifex_mupdfdemo_MuPDFCore_addMarkupAnnotationInternal+258)


这是我的MuPDFCore.java代码http://pastebin.com/8nyGA2hq

请提供适当的解决方案,因为我无法调试并发现代码中的错误在哪里。
谢谢..

最佳答案

问题不在于您发布的Java代码中。看起来好像在C / C ++ Java_com_artifex_mupdfdemo_MuPDFCore_addMarkupAnnotationInternal函数的FindClass调用中。看起来它使用了这种名称搜索:

jclass clazz = (*env)->FindClass(env, "android.graphics.PointF");


但是它使用这种风格:

jclass clazz = (*env)->FindClass(env, "android/graphics/PointF");


也许这些点在4.4上起作用了,但似乎有些可疑。 5.0 ART使JNI变得更加善变,它因Dalvik所忍受的许多违反规范而崩溃。

08-17 22:44