JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception '

04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception 'java.lang.IllegalStateException' thrown in void android.os.MessageQueue.nativePollOnce(long, int):-2
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]     in call to CallVoidMethodV
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]     from void android.os.MessageQueue.nativePollOnce(long, int)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x74beb000 self=0xab267cd8
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   | sysTid=15662 nice=0 cgrp=default sched=0/0 handle=0x4000fbec
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   | state=R schedstat=( 6708953869 1002351941 9337 ) utm=606 stm=64 core=5 HZ=100
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   | stack=0xff18b000-0xff18d000 stackSize=8MB
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #00 pc 00004864  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #01 pc 00003031  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #02 pc 00253c69  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #03 pc 00235249  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+144)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #04 pc 000b13fb  /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #05 pc 000b1b41  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #06 pc 000b4c89  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1292)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #07 pc 000bc153  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+30)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #08 pc 0005fe3f  /system/lib/libandroid_runtime.so (???)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #09 pc 00073ba9  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+40)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #10 pc 00073d71  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+80)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #11 pc 00011203  /system/lib/libutils.so (android::Looper::pollInner(int)+482)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #12 pc 000112ad  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #13 pc 0007fdc1  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   native: #14 pc 000b3cdb  /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+102)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at android.os.MessageQueue.nativePollOnce(Native method)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at android.os.MessageQueue.next(MessageQueue.java:150)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at android.os.Looper.loop(Looper.java:139)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at android.app.ActivityThread.main(ActivityThread.java:5541)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke!(Native method)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke(Method.java:372)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:975)
04-13 17:12:31.996 15662-15662/com.eno.xyzq.page.test A/art: art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

先说下场景:
fragmentA和fragmentB切换,fragmentA中布局是自定义list,fragmentB中简单几个控件,当fragmentA中数据超过100条(每条item高度为50)时,从fragmentA切换到fragmentB,程序崩溃,报错如上,从fragmentB切换到fragmentA没问题;

各种搜寻,几个靠谱答案整理如下:

  1. 兼容性问题;
    JNI对static和非static检查机制,Android4.4之前版本JNI检查机制没有Android5.0之后的版本严格;
    CallVoidMethod的参数非法引用,线程间不能直接传递JNIEnv和jobject这类线程专属属性值
    参考:http://blog.csdn.net/huntcode/article/details/47611245
  2. view高度问题;
    view的高度不能超过4096

    高度超过4096就真的不行了?小编妹各种尝试,也没能完美解决,只能用代码逐层删除的办法,最后发现把专场动画属性添加上的时候就报错了,不添加,程序没问题,睡眠状态中的小编妹终于眼睛睁大了点。

    mFragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);

    由于小编妹要立刻马上趴一会,原谅这没有逻辑的解决方案,具体原因后面再继续编辑。。。

你可能感兴趣的:(JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception ')