JNI ERROR(app bug):访问陈旧的本地引用

时间:2015-07-20 11:47:24

标签: java android android-ndk java-native-interface

我正在使用IPcamera公司提供的libffmpeg.so和libobject_jni.so库开发IPcamera控件应用程序。但是我得到了这个JNI错误(app bug):在使用jni时访问了陈旧的本地引用错误。

这是我的logcat输出:

07-20 18:06:05.326 1576 1576 D dalvikvm: Trying to load lib /data/data/object.ipcam.client/lib/libffmpeg.so 0x4156ba68 
07-20 18:06:05.357 1576 1576 D dalvikvm: Added shared lib /data/data/object.ipcam.client/lib/libffmpeg.so 0x4156ba68 
07-20 18:06:05.357 1576 1576 D dalvikvm: No JNI_OnLoad found in /data/data/object.ipcam.client/lib/libffmpeg.so 0x4156ba68, skipping init 
07-20 18:06:05.365 1576 1576 D dalvikvm: Trying to load lib /data/data/object.ipcam.client/lib/libobject_jni.so 0x4156ba68 
07-20 18:06:05.372 1576 1576 D dalvikvm: Added shared lib /data/data/object.ipcam.client/lib/libobject_jni.so 0x4156ba68 
07-20 18:06:05.372 1576 1576 I : void Java_object_ipcam_nativecaller_NativeCaller_StartPlay(JNIEnv*, _jobject*, jint, jint, _jstring*, jint, _jstring*, _jstring*, _jobject*, _jobject*):enter 
07-20 18:06:05.372 1576 1576 I : ipaddr: 192.168.0.179, port: 80, user: admin, pwd: 123456 
07-20 18:06:05.372 1576 1576 I : void Java_object_ipcam_nativecaller_NativeCaller_StartPlay(JNIEnv*, _jobject*, jint, jint, _jstring*, jint, _jstring*, _jstring*, _jobject*, _jobject*):leave 
07-20 18:06:05.419 1576 1620 E dalvikvm: JNI ERROR (app bug): accessed stale local reference 0xc240002d (index 11 in a table of size 0) 
07-20 18:06:05.419 1576 1620 E dalvikvm: VM aborting 
07-20 18:06:05.419 1576 1620 E mono-rt : 
07-20 18:06:05.419 1576 1620 E mono-rt : Attempting native Android stacktrace: 
07-20 18:06:05.419 1576 1620 E mono-rt : 
07-20 18:06:05.451 1576 1620 E mono-rt : at dvmAbort+113 [0x407cb01e] 
07-20 18:06:05.451 1576 1620 E mono-rt : at IndirectRefTable::get(void*) const+336 [0x407add7c] 
07-20 18:06:05.451 1576 1620 E mono-rt : at dvmDecodeIndirectRef(Thread*, _jobject*)+30 [0x407cf127] 
07-20 18:06:05.451 1576 1620 E mono-rt : at ???+311871 [0x407d123f] 
07-20 18:06:05.451 1576 1620 E mono-rt : at _JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, ...)+60 [0x518aeae8] 
07-20 18:06:05.451 1576 1620 E mono-rt : at CCameraMediaSource::MessageNotify(int)+76 [0x518b0320] 
07-20 18:06:05.451 1576 1620 E mono-rt : at CCameraMediaSource::RecvAVProcess()+884 [0x518b0ed8] 
07-20 18:06:05.451 1576 1620 E mono-rt : at CCameraMediaSource::RecvAVThread(void*)+196 [0x518b11c8] 
07-20 18:06:05.451 1576 1620 E mono-rt : at __thread_entry+48 [0x400d9c10] 
07-20 18:06:05.451 1576 1620 E mono-rt : at pthread_create+172 [0x400d9368] 
07-20 18:06:05.451 1576 1620 E mono-rt : 
07-20 18:06:05.451 1576 1620 E mono-rt : ================================================================= 
07-20 18:06:05.451 1576 1620 E mono-rt : Got a SIGSEGV while executing native code. This usually indicates 
07-20 18:06:05.451 1576 1620 E mono-rt : a fatal error in the mono runtime or one of the native libraries 
07-20 18:06:05.451 1576 1620 E mono-rt : used by your application. 
07-20 18:06:05.451 1576 1620 E mono-rt : ================================================================= 
07-20 18:06:05.451 1576 1620 E mono-rt : 
07-20 18:06:05.451 1576 1620 F libc : Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 1620 (ct.ipcam.client)

我的应用程序的目标API是21,它在此方法崩溃:

void Java_object_ipcam_nativecaller_NativeCaller_StartPlay(JNIEnv*, _jobject*, jint, jint, _jstring*, jint, _jstring*, _jstring*, _jobject*, _jobject*)

但是,当我将目标sdk设置为API 9时,此错误已得到修复。我在线阅读这是因为自android 4.0以来垃圾回收器的更改。但我的应用程序使用Android支持库V7 Cardview,最低支持API为15。

我不想放弃在我的应用中使用支持Lib v7。那么有什么方法可以避免android 4.x中的这个错误?或者我应该联系相机公司让他们提供新版本的库?因为我不知道如何写jni。谢谢你的回复。

0 个答案:

没有答案