Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xiaohaoWit opened this issue Nov 13, 2019 · 7 comments
Open

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

xiaohaoWit opened this issue Nov 13, 2019 · 7 comments

Comments

@xiaohaoWit
Copy link

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)

@gyf-dev
Copy link
Owner

gyf-dev commented Nov 14, 2019

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

@gyf-dev
Copy link
Owner

gyf-dev commented Nov 20, 2019

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

@xiaohaoWit
Copy link
Author

感谢大佬的解答!

@mysiga
Copy link

mysiga commented Dec 11, 2019

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

@gyf-dev
Copy link
Owner

gyf-dev commented Dec 12, 2019

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

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

@wflian
Copy link

wflian commented Feb 28, 2020

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

@walker8
Copy link

walker8 commented Mar 18, 2020

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants