java.lang.UnsatisfiedLinkError:dlopen失败:找不到符号“mbedtls_entropy_func”

时间:2017-05-14 10:42:08

标签: android android-studio android-ndk cmake

我的build.gradle如下所述

apply plugin: 'com.android.application'

android {

    publishNonDefault  true //this line

    compileSdkVersion 21
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "lnt.test.com.myapplication"
        minSdkVersion 21
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"

        ndk {
            abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a','mips','mips64','arm64-v8a'
        }
        externalNativeBuild {
            cmake {
                arguments  '-DANDROID_ALLOW_UNDEFINED_SYMBOLS=true','-DANDROID_PLATFORM=android-21', "-DANDROID_CPP_FEATURES=rtti exceptions","-DANDROID_ABI=armeabi"

            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
       cmake {
            path "src/main/cpp/CMakeLists.txt"
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.2'
}

我得到以下错误日志dlopen失败:无法找到“/data/app/lnt.test.com.myapplication-1/lib/arm/liblwm2m_client.so”引用的符号“mbedtls_entropy_func”... < / p>

1 个答案:

答案 0 :(得分:0)

您的共享库看起来像是与openssl动态链接。你运行readelf -d liblwm2m_client.so | grep NEEDED时会得到什么?如果它需要libssl.so或libcrypto.so,则可能需要静态链接openssl。