android ndk调用java方法有sigsegv错误,无效的段大小4096

时间:2018-04-24 19:14:32

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

AttachCurrentThread方法因此错误而崩溃, 我用:

static JavaVM *g_jvm;

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
    g_jvm = vm;
    JNIEnv *env;
    return JNI_VERSION_1_4;
}

void treadmileCallback(SearchResult result) {
    JNIEnv *env;
    jint i = (*g_jvm)->GetEnv(g_jvm, &env, JNI_VERSION_1_4);
    if( i == JNI_EDETACHED) {
    }

    (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
    .....
}

A/art: art/runtime/thread.cc:2950] **Unable to create protected region
 in stack for implicit overflow check.
 Reason: Invalid argument size:  4096**

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xb8 in tid 5645 (ngiot.sdk.xqiao)
[ 04-25 02:49:22.472  1058: 1058 W/]debuggerd: handling request: pid=5627 uid=10251 gid=10251 tid=5645

Android Studio:3.0.1
Android version:7.1.1

非常感谢,我不知道如何解决这个问题,没有。

0 个答案:

没有答案