JNI在应用中检测到错误

时间:2015-04-16 16:16:25

标签: android

我在WordPress中使用API​​来获取我拥有的标题数量。我的代码适用于除5.x之外的所有Android版本。当我在我的应用程序中推送一个帖子时,很遗憾地关闭了。我不知道Android 5版本有什么问题。有谁知道解决方案是什么?

这是我的logcat:

04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews 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-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]     in call to CallVoidMethodV
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]     from void android.os.MessageQueue.nativePollOnce(long, int)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65] "main" prio=5 tid=1 Runnable
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x87d30ef0 self=0xb4f07800
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   | sysTid=18828 nice=-11 cgrp=apps sched=0/0 handle=0xb6fdeec8
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   | state=R schedstat=( 2249126546 506089308 3210 ) utm=183 stm=41 core=3 HZ=100
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   | stack=0xbe0c8000-0xbe0ca000 stackSize=8MB
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #00 pc 00004640  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #01 pc 00002e8d  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #02 pc 00248381  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+68)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #03 pc 0022cd0b  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+146)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #04 pc 000b189b  /system/lib/libart.so (art::JniAbort(char const*, char const*)+582)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #05 pc 000b1fd5  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #06 pc 000b50e5  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1284)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #07 pc 000bc59f  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+30)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #08 pc 00063803  /system/lib/libandroid_runtime.so (???)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #09 pc 000776bd  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::dispatchVsync(long long, int, unsigned int)+40)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #10 pc 00077885  /system/lib/libandroid_runtime.so (android::NativeDisplayEventReceiver::handleEvent(int, int, void*)+80)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #11 pc 00010f6f  /system/lib/libutils.so (android::Looper::pollInner(int)+482)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #12 pc 00011019  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #13 pc 000830c1  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   native: #14 pc 000b22d7  /system/framework/arm/boot.oat (Java_android_os_MessageQueue_nativePollOnce__JI+102)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at android.os.MessageQueue.nativePollOnce(Native method)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at android.os.MessageQueue.next(MessageQueue.java:143)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at android.os.Looper.loop(Looper.java:130)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at android.app.ActivityThread.main(ActivityThread.java:5832)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke!(Native method)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at java.lang.reflect.Method.invoke(Method.java:372)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
04-16 19:06:54.709  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/check_jni.cc:65]
04-16 19:06:55.509  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #08 pc 000b1a79  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1060)
04-16 19:06:55.509  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #09 pc 000b1fd5  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
04-16 19:06:55.509  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #10 pc 000b50e5  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1284)
04-16 19:06:55.509  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #11 pc 000bc59f  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+30)
04-16 19:06:55.519  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #17 pc 000830c1  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
04-16 19:06:55.519  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #08 pc 000b1a79  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1060)
04-16 19:06:55.519  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #09 pc 000b1fd5  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+60)
04-16 19:06:55.519  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #10 pc 000b50e5  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1284)
04-16 19:06:55.519  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #11 pc 000bc59f  /system/lib/libart.so (art::CheckJNI::CallVoidMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+30)
04-16 19:06:55.519  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #17 pc 000830c1  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc499  /system/lib/libart.so (art::Object_wait(_JNIEnv*, _jobject*)+32)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc499  /system/lib/libart.so (art::Object_wait(_JNIEnv*, _jobject*)+32)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc499  /system/lib/libart.so (art::Object_wait(_JNIEnv*, _jobject*)+32)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #05 pc 000830c1  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #05 pc 000830c1  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #05 pc 000830c1  /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.529  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.539  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.539  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.539  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)
04-16 19:06:55.539  18828-18828/com.example.dmb.materialnews A/art﹕ art/runtime/runtime.cc:286]   native: #04 pc 001fc471  /system/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36)

2 个答案:

答案 0 :(得分:10)

Android 5.0+使用不同的虚拟机(以前是Dalvik,现在是ART)。这个新VM对JNI代码要严格得多。 现在进行的检查之一是不允许您在异常中调用本机代码 您可以在http://developer.android.com/training/articles/perf-jni.html#exceptions找到更多详细信息。 如果您不是本机库的作者,则作者需要更正它。同时,您可以通过避免Java的异常来避免对本机调用的调用,但如果异常发生在您不拥有的库中,则可能无法实现......

答案 1 :(得分:2)

在我的情况下,当尝试为ScrollView设置动画时,此问题与库Transitions Everywhere有关。问题发生在三星设备上 删除延迟转换解决了这个问题。