java lang UnsatisfiedLinkError dlopen failed cannot locate

                       

转载请标明出处:http://blog.csdn.net/xx326664162/article/details/52944525    文章出自:薛瑄的博客
你也可以查看我的其他同类文章,也会让你有一定的收货

首先说明出现下面这个错误的原因可能有很多,你也可以直接看下面的分析,来判断是不是和我一样的问题

介绍一下,在下面的环境中,解决这个问题使用的解决方法。

测试环境:

Galaxy Note3 Android 5.0 
Android studio 2.2.2 
gradle-2.14.1-all 
NDK版本如下图: 
这里写图片描述

项目的build.gradle如下:

android {    compileSdkVersion 24    buildToolsVersion "24.0.3"    defaultConfig {        applicationId "com.firs.facedetecttosvr"        minSdkVersion 19        targetSdkVersion 21        ndk {            moduleName "libface_identify"            abiFilters 'armeabi', 'armeabi-v7a'        }    }   ...(部分省略)    externalNativeBuild {        ndkBuild {            path 'src/main/jni/Android.mk'        }    }}
  
  
    
    
    
    
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

Android.mk配置如下

LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := facetempLOCAL_SRC_FILES := libFiFacial.ainclude $(PREBUILT_STATIC_LIBRARY)include $(CLEAR_VARS)LOCAL_MODULE := jpegtempLOCAL_SRC_FILES := libjpeg.soinclude $(PREBUILT_SHARED_LIBRARY)include $(CLEAR_VARS)#LOCAL_SRC_TCP  := ./tcpSock/maintcp.cpp ./tcpSock/CommLayerTcp.cpp ./tcpSock/NetAuth.cpp ./tcpSock/NetDeal.cpp ./tcpSock/NetPublic.cpp#LOCAL_SRC_TCP  := maintcp.cpp CommLayerTcp.cpp NetAuth.cpp NetDeal.cpp NetPublic.cppLOCAL_MODULE    := libface_identifyLOCAL_SRC_FILES := facelib.cpp public.cpp  maintcp.cpp CommLayerTcp.cpp NetAuth.cpp NetDeal.cpp NetPublic.cpp gb2312.cpp#LOCAL_MODULE_FILENAME = libface_identifyLOCAL_SHARED_LIBRARIES := jpegtempLOCAL_STATIC_LIBRARIES := facetempLOCAL_LDLIBS := -llog -lstdc++include $(BUILD_SHARED_LIBRARY)
  
  
    
    
    
    
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

崩溃时的logcat

10-27 11:47:31.456 30364-30364/com.firs.facedetecttosvr V/BitmapFactory: DecodeImagePath(decodeResourceStream3) : res/drawable-xhdpi-v4/welcome.jpg10-27 11:47:31.666 30364-30364/com.firs.facedetecttosvr E/art: dlopen("/data/app/com.firs.facedetecttosvr-2/lib/arm/libface_identify.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "__exidx_end" referenced by "libface_identify.so"...10-27 11:47:31.666 30364-30364/com.firs.facedetecttosvr D/AndroidRuntime: Shutting down VM10-27 11:47:31.676 30364-30364/com.firs.facedetecttosvr E/AndroidRuntime: FATAL EXCEPTION: main            Process: com.firs.facedetecttosvr, PID: 30364            java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__exidx_end" referenced by "libface_identify.so"...                  at java.lang.Runtime.loadLibrary(Runtime.java:371)                  at java.lang.System.loadLibrary(System.java:989)                  at com.firs.cn.FaceNative.(FaceNative.java:7)                  at com.firs.facedetecttosvr.WelcomeActivity.initDate(WelcomeActivity.java:42)                  at com.firs.facedetecttosvr.WelcomeActivity.onCreate(WelcomeActivity.java:27)                  at android.app.Activity.performCreate(Activity.java:6288)                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)                  at android.app.ActivityThread.access$900(ActivityThread.java:177)                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)                  at android.os.Handler.dispatchMessage(Handler.java:102)                  at android.os.Looper.loop(Looper.java:145)                  at android.app.ActivityThread.main(ActivityThread.java:5942)                  at java.lang.reflect.Method.invoke(Native Method)                  at java.lang.reflect.Method.invoke(Method.java:372)                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
  
  
    
    
    
    
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

解决方法:

第一种:

这个方法解决了我的问题,将NDK的版本换为:android-ndk-r10

ndk.dir=D\:\\Android\\ndk\\android-ndk-r10
  
  
    
    
    
    
  • 1

第二种:

这个方法针对我上面的问题,没有效果,但是很多地方说到这个方法,列出以供参考:

在你报错的库libxxx.so的编译脚本Android.mk请加上:LOCAL_LDFLAGS += -fuse-ld=bfd

参考:
Error trying to load SQL Cipher JNI libs using cordova on Android 4.4.2

Issue 109071: [gold] ndk-10d defaul linker produces corrupt binaries, cannot locate symbol “__exidx_end”

NDK编译库运行时报dlopen failed: cannot locate symbol “__exidx_end” 解决办法

r8c, r8d: bug with __exidx_end & __exidx_start?

 

关注我的公众号,轻松了解和学习更多技术
  这里写图片描述

           

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

你可能感兴趣的:(java lang UnsatisfiedLinkError dlopen failed cannot locate)