There is such java code:
public class HelloJni extends Activity { public void on_connected(Boolean ok) {} };
from NDK I try to call this method like this:
JNIEXPORT void JNICALL connect(JNIEnv *env, jclass) { jclass cls = env->FindClass("com/example/hellojni/HelloJni"); jmethodID mid = env->GetMethodID(cls, "on_connected", "(Z)V"); env->CallVoidMethod(cls, mid, (jboolean)false); }
but I get:
JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.NoSuchMethodError: no non-static method "Lcom / example / hellojni / HelloJni; .on_connected (Z) V"
Don't understand what I'm doing wrong?
And yet, it is not clear why in the error message the method name looks like this (that is, with a comma): "Lcom/example/hellojni/HelloJni;.on_connected(Z)V"
boolean
, notBoolean
. Try replacing theboolean
part of aboolean
in Java (that is, a primitive). - Suvitruf ♦