简体   繁体   中英

Return type of CallStaticBooleanMethodV does not match Java method signature - Calling Java method from C/C++

My java method signature is -

public static void JRequestRender()

And in C/C++

void RequestRender()
{
    ...........
    ...........
    jclass cls = env->GetObjectClass(g_JNIWrapperObj);
    jmethodID mid = NULL;
    if(cls) {
        mid = env->GetStaticMethodID(cls, "JRequestRender", "()V");
    }
    if(mid)
        env->CallStaticBooleanMethod(cls, mid);
    env->DeleteLocalRef(cls);
    .....................
}

This is working in all version of Android except Lollipop. The error log for Lollipop is:

art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: the return type of CallStaticBooleanMethodV does not match void com.foo.bar.MyJniWrapper.JRequestRender()
..........................................
.............................................

JRequestRender returns void, not bool. You need to use CallStaticVoidMethod.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM