Dynamic link issue: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "fread_unlocked"

asked 2019-11-18 03:14:33 -0500


I have an android app which was using openCV 3.4.5 but now need to add opencv_contrib modules to it. I have tried to build and use either 3.4.8 and 4.1.2 with associated opencv_modules versions. I managed to generate the corresponding libopencv_javaX.so and updated my android project accordingly (but I may lack configuration stuff either in openCV or my project).

Each time my app don't even open and crash on the following dynamic link message: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "fread_unlocked" referenced by "/data/app/...

I am not a java developper, all the app in developped in C++ so I don't have a clue of what is happening at that level apart understanding that there is a link issue with libc++_XXX.so used (both static and shared show the same output behavior).

I am using NDK r20, SDK 26.1.1

Not sure if I missed important config in openCV build or if my android app project miss something (working fine with dowloaded openCV SDK 3.4.5 but missing contrib obviously).

Any help will be greatly apreciated, thx !

edit retag flag offensive close merge delete


I'm not a java developper too but I have done this. May be it can help you

LBerger gravatar imageLBerger ( 2019-11-18 03:26:18 -0500 )edit

Thx ! Will study your project and see the differences on how you handle the openCV dependency

NicoBlu gravatar imageNicoBlu ( 2019-11-18 03:31:09 -0500 )edit

Thx LBerger, managed to make my project work with 4.1.2 but weirdly not with 3.4.8, seems dependencies might not be handled exactly the same way ?

NicoBlu gravatar imageNicoBlu ( 2019-11-22 01:56:53 -0500 )edit

sorry I use only opencv 4-dev version and my experience in android is weak as a noob

LBerger gravatar imageLBerger ( 2019-11-22 02:12:16 -0500 )edit

Thx anyway, found out that java folder is not generated for some reason in install folder, guess something is missing in my cfg of opencv build for 3.4.8

NicoBlu gravatar imageNicoBlu ( 2019-11-22 04:03:24 -0500 )edit

to generate opencv I use this

LBerger gravatar imageLBerger ( 2019-11-22 04:33:52 -0500 )edit

It is a known issue in fact, sdk version too high for 3.4.8, should be 25.2.5 max

NicoBlu gravatar imageNicoBlu ( 2019-11-22 04:35:47 -0500 )edit