E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.servicebestpractice, PID: 14967 android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1737) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)求大神帮忙解释一下
3 回答

浪里小神龙
TA贡献16条经验 获得超0个赞
原本的NotificationCompat.Builder (Context context)
被废弃,在API26之后,创建通知需要使用新的构造器NotificationCompat.Builder (Context context, String channelId)
- 3 回答
- 0 关注
- 1570 浏览
添加回答
举报
0/150
提交
取消