12

Without any visible reason, Xiaomi phones with Android 11 started to appear in crashlytics logs. Something happens with notifications. We don't do anything too specific and everything works fine on other Android 11 devices. I wasn't able to reproduce this crash on the affected device. What could be the reason?

First crashes started to appear at the beginning of December, and the amount rapidly grow through January from 10 per day to 100+

crash:

Fatal Exception: android.app.RemoteServiceException
Bad notification(tag=null, id=) posted from package my.application, crashing app(uid=, pid=): Couldn't inflate contentViewsjava.lang.ClassCastException: android.app.Notification$MediaStyle cannot be cast to android.app.Notification$MessagingStyle

Notification style:

    final MediaStyle style = new MediaStyle()
            .setMediaSession(token)
            .setShowActionsInCompactView(PREV_POSITION, PLAY_PAUSE_POSITION, NEXT_POSITION)
            .setCancelButtonIntent(STOP.notificationPending(mContext))
            .setShowCancelButton(true);
    setStyle(style);
Maksim Turaev
  • 4,115
  • 1
  • 29
  • 42
  • 1
    same Fatal Exception: android.app.RemoteServiceException: Bad notification(tag=null, id=100) posted from package in.shadowfax.gandalf, crashing app(uid=XX, pid=XX): Couldn't inflate contentViewsjava.lang.ClassCastException: android.app.Notification$BigTextStyle cannot be cast to android.app.Notification$MessagingStyle – Ishaan Garg Feb 17 '21 at 13:35
  • We're not even posting any notification with MessagingStyle. Are you using Freshchat SDK? We recently deployed that, could be that they're using MessagingStyle notifications – Ishaan Garg Feb 17 '21 at 13:36
  • No, we don't use it. – Maksim Turaev Feb 17 '21 at 14:33
  • I have the same problem, starting from January – Mattia Ruggiero Mar 10 '21 at 09:08

2 Answers2

2

Same problem here. I think this is a bug from MIUI instead of the bug from the app. MIUI changes the notification part a lot for their own look and feel. It may be fixed in future MIUI updates.

Hexise
  • 1,520
  • 15
  • 20
0

From xiaomi:

the crash position is found and i will push R&D to release new version ASAP

And looks like it has been released

enter image description here

Maksim Turaev
  • 4,115
  • 1
  • 29
  • 42
  • Hi, what is the source of the quote "from Xiaomi" ? I have another issue with some Xiaomi devices. Many thanks – StevenTB Aug 23 '21 at 08:50
  • 2
    We asked them about this crash directly and got this answer. We don't have it in the crash reports any more – Maksim Turaev Aug 23 '21 at 14:09