常见问题 FAQ
更新时间:2018-04-28 18:11:57
Q: API 通道 SDK 初始化的时候,出现ErrorCode=103错误
A:在logcat中可以看到类似如下的报错日志:
12-16 16:26:11.430 10486-10486/? W/System.err: ErrorCode = 103
12-16 16:26:11.430 10486-10486/? W/System.err: com.alibaba.wireless.security.open.SecException: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/com.aliyun.iot.demo.wuxi.demoapp/app_SGLib/app_1513412765/libsgmainso-5.3.38.so" is 32-bit instead of 64-bit
12-16 16:26:11.430 10486-10486/? W/System.err: at com.alibaba.wireless.security.mainplugin.SecurityGuardMainPlugin.onPluginLoaded(Unknown Source)
12-16 16:26:11.430 10486-10486/? W/System.err: at com.alibaba.wireless.security.framework.e.a(Unknown Source)
12-16 16:26:11.430 10486-10486/? W/System.err: at com.alibaba.wireless.security.framework.e.c(Unknown Source)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.alibaba.wireless.security.framework.e.c(Unknown Source)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.alibaba.wireless.security.open.initialize.b.a(Unknown Source)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.alibaba.wireless.security.open.initialize.a.loadLibrarySync(Unknown Source)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.alibaba.wireless.security.open.initialize.a.initialize(Unknown Source)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.alibaba.wireless.security.jaq.SecurityInit.Initialize(Unknown Source)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.aliyun.iot.demo.wuxi.demoapp.DemoApplication.onCreate(DemoApplication.java:34)
12-16 16:26:11.431 10486-10486/? W/System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1025)
12-16 16:26:11.431 10486-10486/? W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
12-16 16:26:11.431 10486-10486/? W/System.err: at android.app.ActivityThread.-wrap2(ActivityThread.java)
12-16 16:26:11.431 10486-10486/? W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
12-16 16:26:11.431 10486-10486/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
12-16 16:26:11.431 10486-10486/? W/System.err: at android.os.Looper.loop(Looper.java:154)
12-16 16:26:11.431 10486-10486/? W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6119)
12-16 16:26:11.431 10486-10486/? W/System.err: at java.lang.reflect.Method.invoke(Native Method)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
12-16 16:26:11.431 10486-10486/? W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
这种情形一般是 so 文件加载失败导致的,因为我们的 SDK 仅提供了 armeabi
, x86
两种架构的so,所以,需要过滤其他类型的 so 文件,可以在 build.gradle 文件中添加如下配置:
android {
compileSdkVersion 26
defaultConfig {
...
ndk {
abiFilters "armeabi", "x86"//过滤除 armeabi 和 x86 以外的 so 文件
}
}
}
Q: API 通道 SDK 初始化的时候,出现ErrorCode=202错误
A:在logcat中可以看到类似如下的报错日志:
12-16 13:19:06.586 9344-9344/com.aliyun.iot.demo W/System.err: ErrorCode = 202
12-16 13:19:06.587 9344-9344/com.aliyun.iot.demo W/System.err: com.alibaba.wireless.security.open.SecException:
12-16 13:19:06.594 9344-9344/com.aliyun.iot.demo W/System.err: at com.taobao.wireless.security.adapter.JNICLibrary.doCommandNative(Native Method)
12-16 13:19:06.595 9344-9344/com.aliyun.iot.demo W/System.err: at com.alibaba.wireless.security.mainplugin.a.doCommand(Unknown Source:0)
12-16 13:19:06.595 9344-9344/com.aliyun.iot.demo W/System.err: at com.alibaba.wireless.security.a.j.a.getAppKeyByIndex(Unknown Source:21)
12-16 13:19:06.596 9344-9344/com.aliyun.iot.demo W/System.err: at com.alibaba.sdk.android.push.securitybox.alipush.a.getAppKey(Unknown Source:7)
12-16 13:19:06.597 9344-9344/com.aliyun.iot.demo W/System.err: at com.alibaba.sdk.android.push.vip.AppRegister.h(Unknown Source:17)
12-16 13:19:06.597 9344-9344/com.aliyun.iot.demo W/System.err: at com.alibaba.sdk.android.push.vip.AppRegister.a(Unknown Source:34)
12-16 13:19:06.597 9344-9344/com.aliyun.iot.demo W/System.err: at com.alibaba.sdk.android.push.impl.j.a(Unknown Source:30)
12-16 13:19:06.597 9344-9344/com.aliyun.iot.demo W/System.err: at com.alibaba.sdk.android.push.impl.j.register(Unknown Source:1)
12-16 13:19:06.599 9344-9344/com.aliyun.iot.demo W/System.err: at com.aliyun.iot.aep.demo.DemoApplication.initPush(DemoApplication.java:115)
12-16 13:19:06.599 9344-9344/com.aliyun.iot.demo W/System.err: at com.aliyun.iot.aep.demo.DemoApplication.onCreate(DemoApplication.java:27)
12-16 13:19:06.599 9344-9344/com.aliyun.iot.demo W/System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)
12-16 13:19:06.599 9344-9344/com.aliyun.iot.demo W/System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)
12-16 13:19:06.599 9344-9344/com.aliyun.iot.demo W/System.err: at android.app.ActivityThread.-wrap1(Unknown Source:0)
12-16 13:19:06.601 9344-9344/com.aliyun.iot.demo W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
12-16 13:19:06.601 9344-9344/com.aliyun.iot.demo W/System.err: at android.os.Handler.dispatchMessage(Handler.java:105)
12-16 13:19:06.601 9344-9344/com.aliyun.iot.demo W/System.err: at android.os.Looper.loop(Looper.java:164)
12-16 13:19:06.601 9344-9344/com.aliyun.iot.demo W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6541)
12-16 13:19:06.601 9344-9344/com.aliyun.iot.demo W/System.err: at java.lang.reflect.Method.invoke(Native Method)
12-16 13:19:06.604 9344-9344/com.aliyun.iot.demo W/System.err: at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
12-16 13:19:06.604 9344-9344/com.aliyun.iot.demo W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
这种情形一般是安全图片与当前 apk 的签名不匹配导致的,可以考虑修改当前 apk 签名或者重新上传 apk 生成新的安全图片
Q: API 通道 SDK 初始化的时候,出现ErrorCode=203错误
A: 在logcat中可以看到类似如下的报错日志:
12-16 13:29:59.005 10232-10267/? W/System.err: ErrorCode = 203
12-16 13:29:59.005 10232-10267/? W/System.err: com.alibaba.wireless.security.open.SecException:
12-16 13:29:59.005 10232-10267/? W/System.err: at com.taobao.wireless.security.adapter.JNICLibrary.doCommandNative(Native Method)
12-16 13:29:59.005 10232-10267/? W/System.err: at com.alibaba.wireless.security.mainplugin.a.doCommand(Unknown Source:0)
12-16 13:29:59.005 10232-10267/? W/System.err: at com.alibaba.wireless.security.a.j.a.getAppKeyByIndex(Unknown Source:21)
12-16 13:29:59.005 10232-10267/? W/System.err: at com.alibaba.sdk.android.push.securitybox.alipush.a.getAppKey(Unknown Source:7)
12-16 13:29:59.005 10232-10267/? W/System.err: at com.alibaba.sdk.android.push.securitybox.alipush.a.a(Unknown Source:8)
12-16 13:29:59.005 10232-10267/? W/System.err: at com.alibaba.sdk.android.push.securitybox.alipush.a.getMpsDeviceId(Unknown Source:2)
12-16 13:29:59.005 10232-10267/? W/System.err: at com.alibaba.sdk.android.push.vip.AppRegister$a.b(Unknown Source:68)
12-16 13:29:59.005 10232-10267/? W/System.err: at com.alibaba.sdk.android.push.vip.AppRegister$a.a(Unknown Source:0)
12-16 13:29:59.006 10232-10267/? W/System.err: at com.alibaba.sdk.android.push.vip.b.handleMessage(Unknown Source:54)
12-16 13:29:59.006 10232-10267/? W/System.err: at android.os.Handler.dispatchMessage(Handler.java:105)
12-16 13:29:59.006 10232-10267/? W/System.err: at android.os.Looper.loop(Looper.java:164)
12-16 13:29:59.006 10232-10267/? W/System.err: at android.os.HandlerThread.run(HandlerThread.java:65)
这种情形是因为没找到安全图片导致的。请注意检查安全图片是否在 drawable
目录中,或者检查安全图片的名称的末四位和当前 authCode 是否一致(authCode 默认为 114d
)
Q: 登录阿里云账号时,提示登录失败
A: 排查后台,在开通用户服务时,是否开启自有账号配置,参考下图(对于阿里云账号,刷新URL,GetUserinfo URL可以填写默认值)
Q: 执行登录或者注册时,提示“亲,您的手机网络不太顺畅哦~”
A:可能原因如下:
- 首先确认后台是否开通了用户服务,如果没有开通,请去平台开通,注意生产环境和开发环境都要开通(https://living.aliyun.com/doc#lnkvsd.html)
- 确认登录环境,日常还是线上,注意安全图片的环境必须跟OA设置的环境一样
- 安全图片是否存在(参考上面ErrorCode=202的情况),SDK初始化是否抛出异
- 如果有ErrorCode=110的异常码,请忽略
Q: 访问API时提示异常:
-Ca-Error-Message: Invalid Signature, Server StringToSign:POST#application/json; charset=utf-8#4i1TinIxy5tY/Dar9hCRBQ==#application/octet-stream; charset=utf-8#Fri, 27 Apr 2018 13:15:03 GMT+00:00#x-ca-key:24823500#x-ca-nonce:9ee85b18-c538-45e5-8619-75ed5bcaf530#x-ca-signature-method:HmacSHA1#x-ca-timestamp:1524834903561#/******
Proxy-Connection: Keep-alive