Taras
Taras

Reputation: 2576

UnsatisfiedLinkError when calling native function

I can succesfully load native library with System.loadLibrary(""), but when I call native method from that library, I receive UnsatisfiedLinkError, no implementation found for that method.

But this code works in another application, somehow in mine not.

Upvotes: 0

Views: 369

Answers (2)

Suman
Suman

Reputation: 4251

The method Erik N is suggested fine, but it has some performance impact as the VM need to search a function call with the above signature. Instead you can map the functions with signatures and register them on JNI_OnLoad() function call.

http://docs.oracle.com/javase/1.4.2/docs/guide/jni/spec/functions.html#wp5833

Upvotes: 1

Erik N
Erik N

Reputation: 314

Did you change the packageName in the jni method, it should be Java_com_example_yourapp_methodname(JNIEnv * env, jobject thiz) where com_example_yourapp is the reference to your package of the class you call the method. and after that, did you call ndk-build again?

Upvotes: 3

Related Questions