jni crash dvmAttachCurrentThread strlen

时间:2017-03-16 09:35:02

标签: android java-native-interface

我的Android应用程序崩溃了,跟踪如下:

backtrace:
#00 pc 00016f24 /system/lib/libc.so (strlen+72)
#01 pc 000542e5 /system/lib/libdvm.so (dvmGetThreadName(Thread*)+80)
#02 pc 00051a6f /system/lib/libdvm.so
#03 pc 00052011 /system/lib/libdvm.so (dvmLockObject+192)
#04 pc 0001e71c /system/lib/libdvm.so
#05 pc 0002bb68 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
#06 pc 0005f7f1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
#07 pc 0005f81b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#08 pc 00052f39 /system/lib/libdvm.so (dvmAttachCurrentThread(JavaVMAttachArgs const*, bool)+296

ABI:armeabi-V7A

Android的版本:4.1.1

JNIEnv* getJNIEnv(jint& attached)
{ 
    JNIEnv *env = NULL;
    attached = gGlobalVM->GetEnv(&env, JNI_CURRENT_VERSION);
    if(attached == JNI_EDETACHED){
        if (gGlobalVM->AttachCurrentThread(&env, nullptr) < 0){
            return NULL;
        }
    }
    return env;
}

0 个答案:

没有答案