时间:2020-10-25 14:34:22 | 栏目:Android代码 | 点击:次
错误日志如下:
5-31 12:47:40.088 23896-23896/? E/JIGUANG-JCore: [JCoreGlobal] Get sdk version fail![获取sdk版本失败!]
05-31 12:47:40.088 23896-23896/? W/System.err: java.lang.UnsatisfiedLinkError: Native method not found: cn.jiguang.service.Protocol.GetSdkVersion:()I
05-31 12:47:40.088 23896-23896/? W/System.err: at cn.jiguang.service.Protocol.GetSdkVersion(Native Method)
05-31 12:47:40.088 23896-23896/? W/System.err: at cn.jiguang.b.a.a(Unknown Source)
05-31 12:47:40.088 23896-23896/? W/System.err: at cn.jiguang.b.a.a(Unknown Source)
05-31 12:47:40.088 23896-23896/? W/System.err: at cn.jiguang.api.JCoreInterface.init(Unknown Source)
05-31 12:47:40.088 23896-23896/? W/System.err: at cn.jpush.android.a.a(SourceFile)
05-31 12:47:40.088 23896-23896/? W/System.err: at cn.jpush.android.api.JPushInterface.init(SourceFile)
05-31 12:47:40.088 23896-23896/? W/System.err: at com.baidu.jiangweiqiang.jpush.PushApplication.onCreate(PushApplication.java:17)
05-31 12:47:40.088 23896-23896/? W/System.err: at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:370)
05-31 12:47:40.088 23896-23896/? W/System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:999)
05-31 12:47:40.088 23896-23896/? W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4151)
05-31 12:47:40.088 23896-23896/? W/System.err: at android.app.ActivityThread.access$1300(ActivityThread.java:130)
05-31 12:47:40.088 23896-23896/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
05-31 12:47:40.088 23896-23896/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
05-31 12:47:40.088 23896-23896/? W/System.err: at android.os.Looper.loop(Looper.java:137)
05-31 12:47:40.088 23896-23896/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:4745)
05-31 12:47:40.088 23896-23896/? W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
05-31 12:47:40.088 23896-23896/? W/System.err: at java.lang.reflect.Method.invoke(Method.java:511)
05-31 12:47:40.088 23896-23896/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
05-31 12:47:40.088 23896-23896/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
05-31 12:47:40.088 23896-23896/? W/System.err: at dalvik.system.NativeStart.main(Native Method)
错误分析:
此错误是由于没有正确的加载libjpush.so文件,请检查libjpush.so是否在正确的位置(libs?C>armeabi?C>libjpush.so)
解决方案:
JPush SDK 迁移到 Android Studio 需要添加.SO文件打包到APK的lib文件夹中,可以编辑 build.gradle 脚本,自定义 *.so 目录。
Demo 的参考:
android { // .. android settings .. sourceSets.main { jniLibs.srcDirs = ['libs'] // <-- Set your folder here! } }