Search code examples
androidandroid-ndk

Android NDK link external so Error. java.lang.UnsatisfiedLinkError: dlopen failed: library "libc.so.6" not found


This is cmake file.

add_library( md
        SHARED
        IMPORTED )

set_target_properties( # Specifies the target library.
        md
        # Specifies the parameter you want to define.
        PROPERTIES IMPORTED_LOCATION
        # Provides the path to the library you want to import.
        ${CMAKE_SOURCE_DIR}/jniLibs/${CMAKE_ANDROID_ARCH_ABI}/libmd.so)

target_include_directories(
        jnitest
        PRIVATE
        ${CMAKE_SOURCE_DIR}/include)

target_link_libraries( # Specifies the target library.
        jnitest
        md

        # Links the target library to the log library
        # included in the NDK.
        ${log-lib}
        )

How to solve the problem. "java.lang.UnsatisfiedLinkError: dlopen failed: library "libc.so.6" not found"


Solution

  • Android is not GNU. libc.so.6 is the glibc library. You need to build libmd.so with the NDK.