1.问题
集成推送SDK后出现如下文所示的appKey or deviceId为空的错误,这是怎么回事?
- [backcolor=transparent] com[backcolor=transparent].[backcolor=transparent]alibaba[backcolor=transparent].[backcolor=transparent]sdk[backcolor=transparent].[backcolor=transparent]android[backcolor=transparent].[backcolor=transparent]push[backcolor=transparent].[backcolor=transparent]impl[backcolor=transparent].[backcolor=transparent]IllegalKeyException[backcolor=transparent]:[backcolor=transparent]
- [backcolor=transparent] [backcolor=transparent]AppKey[backcolor=transparent] [backcolor=transparent]or[backcolor=transparent] deviceId [backcolor=transparent]is[backcolor=transparent] empty[backcolor=transparent]!
- [backcolor=transparent] at com[backcolor=transparent].[backcolor=transparent]alibaba[backcolor=transparent].[backcolor=transparent]sdk[backcolor=transparent].[backcolor=transparent]android[backcolor=transparent].[backcolor=transparent]push[backcolor=transparent].[backcolor=transparent]impl[backcolor=transparent].[backcolor=transparent]a[backcolor=transparent].[backcolor=transparent]c[backcolor=transparent]([backcolor=transparent]Unknown[backcolor=transparent] [backcolor=transparent]Source[backcolor=transparent])
- [backcolor=transparent] at com[backcolor=transparent].[backcolor=transparent]alibaba[backcolor=transparent].[backcolor=transparent]sdk[backcolor=transparent].[backcolor=transparent]android[backcolor=transparent].[backcolor=transparent]push[backcolor=transparent].[backcolor=transparent]impl[backcolor=transparent].[backcolor=transparent]a[backcolor=transparent].[backcolor=transparent]a[backcolor=transparent]([backcolor=transparent]Unknown[backcolor=transparent] [backcolor=transparent]Source[backcolor=transparent])
- [backcolor=transparent] at com[backcolor=transparent].[backcolor=transparent]alibaba[backcolor=transparent].[backcolor=transparent]sdk[backcolor=transparent].[backcolor=transparent]android[backcolor=transparent].[backcolor=transparent]push[backcolor=transparent].[backcolor=transparent]impl[backcolor=transparent].[backcolor=transparent]c[backcolor=transparent].[backcolor=transparent]onAppStart[backcolor=transparent]([backcolor=transparent]Unknown[backcolor=transparent] [backcolor=transparent]Source[backcolor=transparent])
2.解决方案
请按照如下步骤进行排查:
- 检查appKey是否有按文档指导方式正确集成;
- 确认SDK是否有正确初始化,若初始化失败deviceId是获取不到的;
- Android推送SDK部分参数是存储在DefaultSharedPreferences中的,其中包括deviceId,请检查项目中是否有对DefaultSharedPreferences做清空操作。