配置custom_notification闪退
ilovexy2tom opened this issue · 1 comments
android.app.RemoteServiceException: Bad notification(tag=null, id=412) posted from package com.xiangmu.lianbushou, crashing app(uid=11225, pid=8792): Couldn't inflate contentViewsandroid.content.res.Resources$NotFoundException: Resource ID #0x0 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.notification.utils.NotificationColorUtils.getNotificationColor(NotificationColorUtils.kt:97) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.notification.utils.NotificationColorUtils.access$getNotificationColor(NotificationColorUtils.kt:18) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.notification.utils.NotificationColorUtils$isDarkNotificationBar$runnable$1.run(NotificationColorUtils.kt:62) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.notification.utils.NotificationColorUtils.isDarkNotificationBar(NotificationColorUtils.kt:81) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.notification.CustomNotification.updateRemoteViewUI(CustomNotification.kt:295) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.notification.CustomNotification.createNotification(CustomNotification.kt:256) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.notification.CustomNotification.onPlaybackStateChanged(CustomNotification.kt:170) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.service.MusicServiceBinder.onChangedNotificationState(MusicServiceBinder.kt:88) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.manager.PlaybackManager.updatePlaybackState(PlaybackManager.kt:433) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.manager.PlaybackManager.onPlayerStateChanged(PlaybackManager.kt:367) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.playback.ExoPlayback$ExoPlayerEventListener.onPlayerStateChanged(ExoPlayback.kt:393) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.playback.ExoPlayback.play(ExoPlayback.kt:154) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.manager.PlaybackManager$onPlayMusicImpl$1.onNext(PlaybackManager.kt:94) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.intercept.InterceptorService.handlerInterceptor(InterceptorService.kt:18) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.manager.PlaybackManager.onPlayMusicImpl(PlaybackManager.kt:88) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.control.PlayerControl.playMusicImpl(PlayerControl.kt:145) 2022-07-14 15:00:32.820 8792-8792/com.xiangmu.lianbushou W/System.err: at com.lzx.starrysky.control.PlayerControl.playMusicByUrl(PlayerControl.kt:102) 2022-07-14 15:00:32.844 8792-8792/com.xiangmu.lianbushou I/StarrySky: PlaybackStage = BUFFERING 2022-07-14 15:00:32.849 8792-8792/com.xiangmu.lianbushou I/StarrySky: isPlayWhenReady = true 2022-07-14 15:00:32.849 8792-8792/com.xiangmu.lianbushou I/StarrySky: --------------------------------------- 2022-07-14 15:00:32.861 8792-8792/com.xiangmu.lianbushou I/StarrySky: PlaybackStage = BUFFERING
配置如下
StarrySky.init(application)
.setDebug(BuildConfig.DEBUG)
.connService(true)
.setNotificationSwitch(true)
.setOpenCache(true)
.setAutoManagerFocus(true)
.setGlobalPlaybackStageListener(playbackStage -> {})
// .setNotificationType(INotification.CUSTOM_NOTIFICATION)
.apply();
发生的现象是在 .setNotificationType(INotification.CUSTOM_NOTIFICATION),其他不变,只要配置了notificationType
NotificationColorUtils
的notification?.contentView?.apply(context, layout) as ViewGroup
必然会闪退
但是取消这一行就不会有这个问题了
是我配置错了