0

I am trying to follow this

I have declared the JNI function as

JNIEXPORT void JNICALL Java_com_mypackage_myapp_MyJavaClass_Fun(JNIEnv* env, jobject object, jobjectArray stringArray)

And the corresponding Java function in MyJavaClass is declared as:

public native void Fun(String[] strArray);

But its not working for me as I keep getting run time error:

No implementation found for void com.mypackage.myapp.MyJavaClass.Fun(java.lang.String[])

I have also tried declaring Fun as

public native void Fun(List<String> strArray);

And

public native void Fun(ArrayList<String> strArray);

but these also result in same run time error

5
  • Does your log show that the JNI library is loaded successfully? Can you call some other native method? Commented Jul 13, 2016 at 8:31
  • Show us your System.loadLibrary() call Commented Jul 13, 2016 at 8:56
  • Also ensure that there are no overloads for Fun() in java code. Commented Jul 13, 2016 at 9:34
  • I found the mistake. I was calling Fun() before System.loadLibrary() was being called. Thanks @samgak. But I am wondering is there a way to avoid this? Right now the System.loadLibrary() is being called in onResume(). Can this be called in onCreate() instead? Commented Jul 13, 2016 at 15:10
  • put it in a static initializer for the class Commented Jul 13, 2016 at 16:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.