Fatal Exception: java.lang.UnsatisfiedLinkError on Android CMakeLists NDK

29 views Asked by At

There is an error occur lately on just a few devices out of 80000 devices. Below is to error log:

Fatal Exception: java.lang.UnsatisfiedLinkError
dlopen failed: cannot find "" from verneed[0] in DT_NEEDED list for "/data/app/~~DtZxZLpyOjz12DvhSYDeBw==/my.app.package-tsvKH9Qp8jm31esfDPeiuQ==/lib/arm64/libnative_lib.so"

In build.gradle:

android {
    ...
    defaultConfig {
        ...
        externalNativeBuild {
            cmake {
                cppFlags "-std=c++14"
            }
        }
        ndk {
            abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
        }

    }
    ...
    ndkVersion '21.3.6528147'
    externalNativeBuild {
        cmake {
            version '3.10.2'
            path "src/main/cpp/MyCMakeLists.txt"
        }
    }
    ...
}

In MyCMakeLists.txt:

cmake_minimum_required(VERSION 3.4.1)

add_library(native_lib SHARED native_lib.cpp)

# Include libraries needed for kotlin-jni lib
target_link_libraries(native_lib android log)

Actually, it was working without the error for a few years already. The error just happened on the last release just a few devices. Could you please help to find the cause and provide solution on this?

Thank you in advance!

0

There are 0 answers