Cactus icon indicating copy to clipboard operation
Cactus copied to clipboard

还是会有关于通知渠道的崩溃

Open xiaohaoWit opened this issue 5 years ago • 7 comments

android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=Cactus pri=-2 contentView=null vibrate=null sound=null defaults=0x0 flags=0x50 color=0x00000000 vis=PRIVATE) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2126) at android.os.Handler.dispatchMessage(Handler.java:112) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7625) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

xiaohaoWit avatar Nov 13 '19 01:11 xiaohaoWit

什么手机,android版本是多少?是偶现还是必现?你是点击如下按钮出现的奔溃吗?还是启动就报错了? 20191114105605 或者 20191114125138

gyf-dev avatar Nov 14 '19 01:11 gyf-dev

说下为什么会出现这个问题的原因,因为android 8.0之后隐藏通知栏,使用的是deleteNotificationChannel方法隐藏,当app奔溃时候,cactus会进行拉活,但是发现不存在这个相应的渠道信息,所以就报错了。但是cactus会继续拉活,再一次拉活就不会出现这个问题了。除非你使用hideNotificationAfterO(false)方法不隐藏android 8.0之后的通知栏,或者保证你们的app永远不会奔溃(理论上不可能)。PS:我也在寻找其他方法解决此问题,目前还没有找到

gyf-dev avatar Nov 20 '19 02:11 gyf-dev

感谢大佬的解答!

xiaohaoWit avatar Nov 25 '19 06:11 xiaohaoWit

碰到同样问题,如果目前找不到方案解决可以先try_catch了,每个app都有崩溃率的kpi。所以还是要慎重

mysiga avatar Dec 11 '19 13:12 mysiga

碰到同样问题,如果目前找不到方案解决可以先try_catch了,每个app都有崩溃率的kpi。所以还是要慎重

RemoteServiceException是系统级别的异常,try_catch无法捕获,如果不介意还是把android8.0之后的通知显示出来吧hideNotificationAfterO(false)

gyf-dev avatar Dec 12 '19 01:12 gyf-dev

设置hideNotificationAfterO(true) 之后,出现的概率还是很大了,间隔一段时间 就会出现奔溃

wflian avatar Feb 28 '20 06:02 wflian

设置hideNotificationAfterO(true) 之后,出现的概率还是很大了,间隔一段时间 就会出现奔溃

同样的问题,目前有好的解决方案不?

walker8 avatar Mar 18 '20 15:03 walker8