今天要在项目中集成极光推送,运行时报错
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcn/jpush/android/service/PushProtocol;
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample E/JPush: [JPushGlobal] Get sdk version fail![获取sdk版本失败!]
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: java.lang.UnsatisfiedLinkError: Couldn't load jpush205 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.hansheng.jgpushexample-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.hansheng.jgpushexample-2, /vendor/lib, /system/lib]]]: findLibrary returned null
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at java.lang.Runtime.loadLibrary(Runtime.java:358)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at java.lang.System.loadLibrary(System.java:526)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at cn.jpush.android.service.PushProtocol.<clinit>(Unknown Source)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at cn.jpush.android.b.a(Unknown Source)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at cn.jpush.android.b.a(Unknown Source)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at cn.jpush.android.api.JPushInterface.init(Unknown Source)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at com.hansheng.jgpushexample.application.ExampleApplication.onCreate(ExampleApplication.java:19)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at android.app.ActivityThread.access$1500(ActivityThread.java:141)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1262)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at android.os.Looper.loop(Looper.java:136)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5047)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at java.lang.reflect.Method.invokeNative(Native Method)
12-28 18:06:09.523 18566-18566/com.hansheng.jgpushexample W/System.err: at java.lang.reflect.Method.invoke(Method.java:515)
12-28 18:06:09.533 18566-18566/com.hansheng.jgpushexample W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
12-28 18:06:09.533 18566-18566/com.hansheng.jgpushexample W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
12-28 18:06:09.533 18566-18566/com.hansheng.jgpushexample W/System.err: at dalvik.system.NativeStart.main(Native Method)
12-28 18:06:09.533 18566-18566/com.hansheng.jgpushexample E/JPush: [JPushGlobal] JPush .so file do not match JPush .jar file in the project, Failed to init JPush
12-28 18:06:09.603 18566-18600/com.hansheng.jgpushexample W/JPush: [SharePreferenceProcess] context is null, in SharePreferenceProcess.init
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
如果在添加了lib文件之后,add as liability之后,在build.gradle文件中的dependencies中也配置了路径,但是还是报错UnsatisfiedLinkError 可以试一下添加上述配置。