Skip to content Skip to sidebar Skip to footer

Android Ndk : Problem For Call Of Java Method From C++ With Jni

I try to work on Android NDK, my first test are not very conclusive, I need for help because I don't see where is my error. The following code compiles without problem but when is

Solution 1:

After one day lost due to this bug, i finally found the solution of my problem :

The function javaCallJNI() is declared as a static native in Java, but, a static method can't call a non static method...

For resolve this problem, just replace :

publicstatic native voidjavaCallJNI();

by

public native voidjavaCallJNI();

in JNITestActivity.java

Thank for your help and see soon ;)

Solution 2:

What you have looks okay to me... but you might try replacing

jclass clazz = env->FindClass("com/test/jnitest/JNITestActivity");

With

jclass clazz = env->GetObjectClass(obj);

Post a Comment for "Android Ndk : Problem For Call Of Java Method From C++ With Jni"