Evgeni Roitburg
Evgeni Roitburg

Reputation: 2097

Static native method: cannot resolve corresponding JNI function

Im getting the mentioned error while declaring static native method: enter image description here

From the native side the link is working as expected: enter image description here

Everything works as expected the problem is just the link(Android Studio 3.1.1) from java to the native reference which is broken for static(works for non-static ones) methods.

Upvotes: 1

Views: 1987

Answers (3)

touhid udoy
touhid udoy

Reputation: 4442

I am not expert but I changed the second parameter from jobject to jclass and it worked for me.

Upvotes: 0

BOOtak
BOOtak

Reputation: 124

Try to change the type of the second argument in JNI method from jclass to jobject. Worked for me

Upvotes: 1

Alex Cohn
Alex Cohn

Reputation: 57203

There exists a funny workaround:

  1. remove the word 'static' in Java.
  2. click on the red bulb to 'Create function Java_…_jniInitCore()'
  3. restore the word 'static' in Java file.

Upvotes: 3

Related Questions