Bad notification posted - Couldn't expand RemoteViews for: StatusBarNotification

前端 未结 15 1860
执笔经年
执笔经年 2020-12-03 06:47

I am trying to post a notification with a custom view in the notification area from an IntentService, and getting the Couldn\'t expand RemoteView e

相关标签:
15条回答
  • 2020-12-03 07:16

    @Nikolai's answer was helpful for me, indeed it was the problem. I had the same issue. There are specific controls that can be used in the notification. I had a View in my layout for notification as below.

    <View
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="0.04"/>
    

    This was causing the crash. Following Layouts and controls are supported:

    As per this official documentation.

    I removed it and it worked fine. Hope it helps someone.

    0 讨论(0)
  • 2020-12-03 07:17

    i see the is alot of trouble related to this topic, in my case this problem was caused by using

    android:background="?attr/selectableItemBackground" 
    

    i used that on my ImageButton and each time my app crashed but when i removed it, everything was fine, i guess the problem is you should not use any custom View type or any theme attributes on your views, i hope this will help another stuck with this problem

    0 讨论(0)
  • 2020-12-03 07:19

    For me the problem was on NotificationCompat.Builder.addAction the icon i set for action not compatible with all devices . I use Andriod Studio -> File -> New -> Image Asset to generate the icon then it fine .

    0 讨论(0)
提交回复
热议问题