java.lang.UnsatifiedLinkError: dlopen failed:library ""not found

Asked 3 months ago, Updated 3 months ago, 8 views

Attempted to create by cross-compiling the third-party code for Android.The app is Android Studio and the build was successful, but when running the app, the following error occurs:

logcat error log

java.lang.UnsatisfiedLinkError: dlopen failed:library""not found

so.0 on is somehow the cause, but I don't know what to do with Android Studio.

The readelf command is as follows:

$readelf-d | grep SONAME
0x00000000000000000e (SONAME) Library soname: []

CMakeLists.txt is as follows



add_library (hello-jni SHARED src/main/cpp/hello-jni.cpp)

target_link_libraries (hello-jnilibXXXX${log-lib})

The Java code is as follows:

    System.loadLibrary ("hello-jni");

·Even if I put in the same location as the so file, the error remained.
·I also tried libXXXXXX.a (STATIC LIBRARY) and it was successfully executed.

I thought I might add SONAME-related options to CMakeLists.txt, but I didn't really understand.I look forward to working with you on the solution.

The situation has changed.

Failed to loadLibrary

    System.loadLibrary ("hello-jni");

New logcat error log

java.lang.UnsatisfiedLinkError: dlopen failed:cannot locate symbol**"acos"**referenced by""...

Regarding the error without acos, is there no acos on Android?Is it difficult to solve this problem?Thank you for your cooperation.

I tried to change the following, but the situation did not change (remain the same error)


target_link_libraries (hello-jnilibXXXXm${log-lib})

Java Code

    System.loadLibrary ("hello-jni");

Thank you for your continued support.

android android-studio

2022-09-30 13:46

1 Answers

I got there looking into a similar problem myself.
I found this document about API24 and later restrictions.

The native library uses only public APIs and should not be linked to non-NDK platform libraries.API24
From the , this rule is applied and applications are no longer able to read non-NDK platform libraries.Because this rule is enforced by dynamic linkers, non-public libraries are not accessible regardless of how the code is read.System.loadLibrary, DT_NEEDED
Entries and direct calls to dlopen(3) all behave exactly the same way.

2022-09-30 13:46

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.