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
@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.
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
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 .