0

For calling java function's in Android Activity from JNI, I use the following code :

    jmethodID messageMe = env->GetStaticMethodID(clazz, "updateStatus", "(IILjava/lang/String;)V");
    env->CallStaticVoidMethod(clazz, messageMe);

it's working perfectly for Android 2.3 but not working for Android 4.0.3, I get this error message E/dalvikvm(9341): JNI ERROR (app bug): accessed stale global reference 0x5b6130b2 (index 19500 in a table of size 125)

so, how can i call correctly java function from jni for both new and old versions

Thanks

Michael Kohne
  • 11,888
  • 3
  • 47
  • 79

1 Answers1

0

You're not passing in any parameters to CallStaticVoidMethod - it's expecting 4 as you can see in the method signature string.

I read in another question this error is caused by passing in an incorrect parameter type: Error: JNI ERROR (app bug): accessed stale global reference

Community
  • 1
  • 1
krsteeve
  • 1,794
  • 4
  • 19
  • 29