3

The application shows an ongoing notification on start (in certain cases). The application crashes on start sometimes during the app update and it seems that it happens after NotificationManager.notify(…) call.

Fatal Exception: android.app.RemoteServiceException: Bad notification(tag=null, id=30) 
posted from <package>, crashing app(uid=10288, pid=28319): 
Couldn't inflate contentViewsandroid.view.InflateException: 

Binary XML file line #21 in <package:layout>: Error inflating class android.view.View
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1973)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:224)
       at android.app.ActivityThread.main(ActivityThread.java:7562)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

The layout file mentioned in the crash message is NOT used as the notification layout. The notification does have a layout file used for RemoteView layout but it inflates ok.

After reading different topics on the internet I think this happens because layout file integer id changes after the app update.

Application build with gradle, minifyEnabled, targetSdk=29, multidex. Crash detected by Crashlytics. Observed on Android 10.

Have anyone met such a problem? Is it possible to fix this situation?

  • i have the same problem! did you find any solution? – richard slond Feb 25 '21 at 12:35
  • There is a questionable solution suggested [here](https://stackoverflow.com/questions/65734822/crash-while-inflating-ongoing-notification-layout-right-after-upgrade-android-1/65869408#65869408). – Олег Казьмин Feb 26 '21 at 15:32
  • 1
    nah. that is no solution at all. What about adding the layout id to public.xml file so it stays the same after app updates? I have shipped this solution to production and i expect it to work. I cannot reproduce it locally so that's by best hope – richard slond Mar 01 '21 at 10:38
  • I tried the public.xml with no luck. The only thing I really expect to work at the moment is to update the notification id on every release. As I understand the notification system is somehow caching notification info along with layout ids. Possibly if I change the notification id the system is not able to restore the notification from the cache because the id is changed. – Олег Казьмин Mar 01 '21 at 16:56
  • Another thing to mention about the public.xml approach. [Here](https://stackoverflow.com/questions/9348614/what-is-the-use-of-the-res-values-public-xml-file-on-android#comment70640868_9357813) is mentioned that the functionality seems to be broken. – Олег Казьмин Mar 02 '21 at 09:41

0 Answers0