Native function no implementation found

Stanislav Parkhomenko :

Problem: 20% of users are receiving:

Fatal Exception: java.lang.UnsatisfiedLinkError
No implementation found for java.lang.String com.example.utils.API.getHashString(android.content.Context) (tried Java_com_example_utils_API_getHashString and Java_com_example_utils_API_getHashString__Landroid_content_Context_2)

For other 80% app working perfectly, no exception on my test devices as well. Can't figure out what's the problem.

EDIT1: Library loads perfectly on splash screen. No exception on that point.

static { System.loadLibrary("my-lib"); }

EDIT2: Just reproduced the error. It is absolutely random. App function call works fine, and at some time it starts failing. The only fix is re-installing the app.

Xavier Rubio Jansana :

Following my comment and later comments from @stanislav-parkhomenko, I'm reposting it as an answer. Thanks!

My comment:

Where is the static {...} block located? A possible reason for this could be that the code is not executed before some calls.

And later confirmed by himself that this was the cause:

The problem was in library initialization. Splash screen run not always, because of sharing functionality, thats why some times library did not load.

Thanks to Xavier Rubio Jansana for advice, which cured my blindness.

Glad it helped!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=454906&siteId=1