1

Recently we're encountering a very weird issue in production, and it only happens intermittently even on some modern Android devices. The issue is "java.lang.UnsatisfiedLinkError: No implementation found" when a specific function is called, and that function is called every time but the issue does not occur all the time. We've tried using ReLinker but unfortunately the issue hasn't been resolved.

A bit of the background, we develop a SDK which is part of an Android app. In our SDK, we make use of some native functions. The loading of the native library using System.loadLibrary() is done in the static block of our main class. So by right, when our class is triggered, our native library should be loaded, and that issue shouldn't occur, unfortunately it's not the case here. Is there a possibility that a function from our SDK is invoked while the library is not loaded yet?

We're kind of stuck and really running out of thoughts, so any help would be really appreciated. Thank you!

hoang.tran
  • 57
  • 1
  • 9
  • I am seeing the same issue with an app that is in production. On 99% of devices it is working, but some users keep getting an unsatisfied link error on startup. These users are running different devices from Samsung, OnePlus and all different Android versions up to 13. This can't be related to a misspelling or missing `extern "C"` otherwise it would not work on 99% of devices. – Andy Apr 16 '23 at 08:32

1 Answers1

0

System.loadLibrary() needs to be called before the method is used.. can you try moving it out of the static block. Also double check the names.

missing extern "C" also causes UnsatisfiedLinkError

Ref:SO question for further reference

Narendra_Nath
  • 4,578
  • 3
  • 13
  • 31
  • Thank you for your answer. If it's because of the typo in the function name, or missing of ```extern "C"``` then the issue should happen consistently because that function is invoked all the time, right? But in this case, it happens intermittently. When you say to move it out of the static block, you mean ```System.loadLibrary()``` or something else? – hoang.tran May 05 '22 at 03:49
  • Yes move the System.loadLibrary() out from the static block – Narendra_Nath May 05 '22 at 04:03
  • May you elaborate on that? I thought putting in the static block would be the standard practice, as it would be executed when the class is loaded. Or am I missing anything here? – hoang.tran May 05 '22 at 04:11
  • Check C file name, Build arch platforms and consider libs implementation in dependency. And I am also not sure calling loadLibrary() outside the static block really works – Rohit Patil May 05 '22 at 05:58