Android模块化开发,推动问题

标签: #<Tag:0x00007f65825dd3d0>

模块化开发,接入推送,效果极不稳定,有时候很快,有时候一二十分钟,而且不能设置别名(设置了别名失败),新建项目都没有问题,是不是模块化的支持不好?

这得看你是怎么接入的

设置失败的报错是什么,收不到消息时长连接是否建立

我就是按照文档的步骤接入的,新项目没有问题,正常,
设置失败没有保存信息,什么都看不到,只是在后台模拟推送的时候提示没有这个别名而已
所有的日志就下边这些……

D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY

这些日志信息没有什么用。

如果能复测,就查看设置别名失败时的报错信息,完整的日志信息

当收不到消息的时候,排查提供信息

有这么一个问题,你们看一下

 W/JIGUANG-JCore: [JServiceCommandHelper] throwable , remote call failed, error:android.os.DeadObjectException

版本号:

api 'cn.jiguang.sdk:jpush:3.1.6'
api 'cn.jiguang.sdk:jcore:1.2.5'

这只是警告,请给出完整的日志来分析,不要截取

JPushInterface.setAlias(this,0,username);
走完这一步后,完整的日志就是这些,并不是截取,没有实质性的日志打印出来 :cold_sweat:
W/JIGUANG-JCore: [JServiceCommandHelper] throwable , remote call failed, error:android.os.DeadO
W/JIGUANG-JCore: [JServiceCommandHelper] throwable , remote call failed, error:android.os.DeadO
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY

是不是没有开启 debug,手机日志权限没开启,日志等级筛选过高等?

你从初始化开始提供,先看集成成功了没

开始初始化
D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.1.6, buildId:416
D/JIGUANG-JPush: [AndroidUtil] action:checkValidManifest
D/JIGUANG-JCore: [JCoreGlobal] action:init - sdkVersion:1.2.5, buildId:195
D/JIGUANG-JCore: [JCoreGlobal] manifest:channel - developer-default
D/JIGUANG-JCore: [JCoreGlobal] metadata: appKey - 5fc0563b6165a6165e373ab9
D/JIGUANG-JCore: [AndroidUtil] action:checkValidManifest
D/JIGUANG-JCore: [JCoreServiceUtils] set Push/Alarm Receiver enabled
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
设置别名就这样了:
W/JIGUANG-JCore: [JServiceCommandHelper] throwable , remote call failed, error:android.os.DeadObjectException
W/JIGUANG-JCore: [JServiceCommandHelper] throwable , remote call failed, error:android.os.DeadObjectException
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
W/JIGUANG-JCore: [JServiceCommandHelper] throwable , remote call failed, error:android.os.DeadObjectException
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.ACTION_REPORT_HISTORY
W/JIGUANG-JCore: [JServiceCommandHelper] throwable , remote call failed, error:android.os.DeadObjectException
初始化肯定没问题,因为有时能收到推送,只是不是很未定,但是设置别名一直没有成功

根据你的这个日志也并不能看出你是已经初始化成功了的

首先需要保证初始化成功,其次需要保证在初始化成功之后,再去调 API 设置别名

那如何才能看到初始化成功了呢?
我能拿到我的 RegistrationID,这样算不算是初始化成功了

这是我打印的RegistrationId

D/JpushRegistrationID: 120c83f760633fc8bd4

这个可以判断为初始化成功了,但不能判断你是否是在初始化成功后才调 API 设置别名的,也看不到别名失败后的回调信息,你有配别名相关的广播吧?
https://docs.jiguang.cn/jpush/client/Android/android_api/#_66

这有个奇怪的现象,我在新项目里面也配置了别名相关的广播,能看到打印的日志信息,
但是我在我的原本的项目里配置了一样的,却没有触发广播,这是什么原因,写法完全一样,:neutral_face:

这是什么原因呢,直接调用失败了呗? =_=!两个项目唯一的区别就是模块化与非模块化

emmm,不太清楚你的这个模块化的具体做法,是否可能你在模块化后初始化未成功的时候就调了 API 设置别名?

你设置在取到了 registrationID 后再去设置别名试试呢

我现在就是拿到 registrationID 之后才调用的设置别名 :disappointed_relieved:

那你这样吧,直接推送消息给别名,看是不是报错,还是推送成功

不行的,直接说提示 :cold_sweat:

则此别名或者标签还没有在任何客户端SDK提交设置成功