Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JNI DETECTED ERROR IN APPLICATION

Tags:

android

I am using an API in WordPress to get how many titles I have. My code works well for all Android versions except 5.x. When I push a thread in my app it unfortunately closed. I don't know what is wrong with Android 5 versions. Does anyone know what the solution is?

This is my 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)
like image 561
Dauezevy Avatar asked Apr 16 '15 16:04

Dauezevy


2 Answers

Android 5.0+ uses a different virtual machine (previously Dalvik, and now ART). This new VM is much more strict with JNI code. One of the check that is made now is that you are not allowed to call native code from within an Exception.
You can find more details at http://developer.android.com/training/articles/perf-jni.html#exceptions. If you are not the author of the native library, the author needs to correct it. Meanwhile, it may be possible for you to avoid the call to the native calls by avoiding the exceptions from Java, but if the exception occurs in a library you do not own, it may as well not be possible...

like image 147
Stef Avatar answered Oct 07 '22 08:10

Stef


In my case, this problem was related to library Transitions Everywhere when tried to animate ScrollView. And the issue occurred on Samsung devices.
Removing that delayed transition solved the issue.

like image 32
Leonid Ustenko Avatar answered Oct 07 '22 06:10

Leonid Ustenko