详细解答可以参考官方帮助文档
在推送SDK初始化的过程中报类似如下的错误:
java.lang.UnsatisfiedLinkError: No implementation found for int org.android.spdy.SpdyAgent.configLogFileN(java.lang.String, int, int) (tried Java_org_android_spdy_SpdyAgent_configLogFileN and Java_org_android_spdy_SpdyAgent_configLogFileN__Ljava_lang_String_2II)
at org.android.spdy.SpdyAgent.configLogFileN(Native Method)
at org.android.spdy.SpdyAgent.configLogFile(Unknown Source)
at com.taobao.accs.net.e.<init>(Unknown Source)
at com.taobao.accs.net.BaseConnection.a(Unknown Source)
at com.taobao.accs.internal.ACCSManagerImpl.sendControlMessage(Unknown Source)
at com.taobao.accs.internal.ACCSManagerImpl.bindApp(Unknown Source)
at com.taobao.accs.a.a(Unknown Source)
at com.taobao.agoo.AliyunRegister.register(Unknown Source)
at com.alibaba.sdk.android.push.vip.AppRegister$a.b(Unknown Source)
at com.alibaba.sdk.android.push.vip.AppRegister$a.a(Unknown Source)
at com.alibaba.sdk.android.push.vip.b.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
或
04-20 11:34:02.035 15264-15383/cloud.aliyun.test E/awcn.TnetSpdySession: |[seq:AWCN2_2] connect exception org.android.spdy.SpdyErrorException: TNET_JNI_ERR_LOAD_SO_FAIL
at org.android.spdy.SpdyAgent.checkLoadSo(Unknown Source)
at org.android.spdy.SpdyAgent.agentIsOpen(Unknown Source)
at org.android.spdy.SpdyAgent.createSession(Unknown Source)
at org.android.spdy.SpdyAgent.createSession(Unknown Source)
at anet.channel.d.l.b(Unknown Source)
at anet.channel.SessionRequest.a(Unknown Source)
at anet.channel.SessionRequest.a(Unknown Source)
at anet.channel.SessionRequest$a.onFailed(Unknown Source)
at anet.channel.k.onEvent(Unknown Source)
at anet.channel.i.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
这是什么原因引起的?
推送SDK包含有so包(libtnet、libcocklogic),出现上述错误都是由于so包没有被成功加载导致的。请通过以下方法确认so包是被被正常添加:
将生成的.apk文件以.zip文件解压,查看对应的jniLibs是否正确包含armeabi、armeabi-v7a、x86体系架构的目录,检查是否有移动推送的libcocklogic.so和libtnet.so
通过远程同步的方式集成推送SDK。推送SDK在V3.0.0及以上版本开始支持远程同步集成,在远程同步的过程中so包也被自动同步。推送SDK当前提供:armeabi,armeabi-v7a,arm64-v8a,mips,mips-64,x86,x86_64等架构的so包,如果您不需要这么多,可以在build.gradle文件中进行配置,选择需要的so包:
android {
......
defaultConfig {
applicationId "com.xxx.xxx"
......
ndk {
//选择要添加的对应cpu类型的.so库。
abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a'
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
}
......
}
......
}
手动添加so包,将所需架构的so包放到指定路径默认为”src/main/jniLibs/‘’,若设置其他路径如libs,需要手动在build.gradle文件中指定:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。