Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android M crash java.lang.UnsatisfiedLinkError: dlopen failed:

Tags:

android

My Android application is crashing and giving me the following error message:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate

like image 873
Subramanyam G Avatar asked Sep 29 '15 13:09

Subramanyam G


2 Answers

Crash is coming because of following fact that has been changed in Android M

"On previous versions of Android, if your app requested the system to load a shared library with text relocations, the system displayed a warning but still allowed the library to be loaded. Beginning in this release, the system rejects this library if your app's target SDK version is 23 or higher. To help you detect if a library failed to load, your app should log the dlopen(3) failure, and include the problem description text that the dlerror(3) call returns. To learn more about handling text relocations, see this guide"

for more details please refer to this link

like image 181
dex Avatar answered Jan 08 '23 10:01

dex


Before anything I must say that I do not understand all the specifics behind that subject, but I'll try to guide you through the path that helped me.

I saw that that problem appeared only when using target version as 23. Reading other posts was easy to identify that that happened with libs compiled with older ndk tools (ndk-build, to be more specific, but I do not know exactly if that tool came later for fulfilling new needs).

It happened with me using libiconv, a dependency from ZBar project. So I thought that recompiling it would help, and helped. I used the ndk-build tool to recompile zbar and iconv libs.

I hope it suffices.

like image 42
Andre Luiz Fernandes de Mello Avatar answered Jan 08 '23 11:01

Andre Luiz Fernandes de Mello