• java.lang.UnsatisfiedLinkError: Couldn't load hyphenate_av from loader dalvik.system.PathClassLoader


    android studio引入第三方库时报如下异常。

    06-15 16:50:24.477 9497-9497/easemobim.test.com.easemobim E/AndroidRuntime: FATAL EXCEPTION: main
            java.lang.UnsatisfiedLinkError: Couldn't load hyphenate_av from loader dalvik.system.PathClassLoader[dexPath=/data/app/easemobim.test.com.easemobim-1.apk,libraryPath=/data/app-lib/easemobim.test.com.easemobim-1]: findLibrary returned null
                at java.lang.Runtime.loadLibrary(Runtime.java:365)
                at java.lang.System.loadLibrary(System.java:535)
                at com.hyphenate.chat.EMClient.loadLibrary(Unknown Source)
                at com.hyphenate.chat.EMClient.getInstance(Unknown Source)
                at easemobim.test.com.easemobim.MainActivity.onCreate(MainActivity.java:57)
                at android.app.Activity.performCreate(Activity.java:5104)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1092)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2254)
                at android.app.ActivityThread.access$600(ActivityThread.java:141)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:5069)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
                at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
                at dalvik.system.NativeStart.main(Native Method)

      原因是android studio导入so文件没有编译到apk里面去,所以导致UnsatisfiedLinkError异常
      打开app下的build.gradle,在android的标签下加入如下代码:

      sourceSets {
            main {
                //jni库的调用会到资源文件夹下libs里面找so文件
                jniLibs.srcDirs = ['libs']
             }
            }

      如:

    android {
        ... ...
    
        sourceSets{
            main{
                jniLibs.srcDirs = ['libs']
            }
        }
        
        ... ...
    }
  • 相关阅读:
    JS中document对象和window对象有什么区别
    jQuery parent.append和$after的区别
    使用CFURLCreateStringByAddingPercentEscapes进行URL编码
    JQuery中==与===、$("#")与$("")的区别
    理解JavaScript中的arguments,callee,caller,apply
    使用自己的ClassLoader实现热替换
    TextBox 英文文档
    easyui的textbox和validatebox的 赋值区别
    jquery的$.extend、$.fn.extend、 jQuery.extend( target, object1, [objectN])作用及区别
    jQuery 遍历
  • 原文地址:https://www.cnblogs.com/rwxwsblog/p/5588177.html
Copyright © 2020-2023  润新知