I'm encountering a crash in production that I cannot reproduce locally. The crash is logged in Crashlytics as follows:
Fatal Exception: android.app.RemoteServiceException$BadForegroundServiceNotificationException: Bad notification(tag=null, id=187544) posted from package com.example.android, crashing app(uid=10187, pid=18102): Couldn't inflate contentViewsandroid.widget.RemoteViews$ActionException: android.view.InflateException: Binary XML file line #77 in com.example.android:layout/preference_widget_seekbar: Binary XML file line #77 in com.example.android:layout/preference_widget_seekbar: Error inflating class androidx.preference.UnPressableLinearLayout
at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2019)
at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2275)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7937)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:569)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)
The exception references a layout file notification_content, but neither the foreground service nor the notification in my code uses this layout. Interestingly, the referenced file name (layout/notification_content) changes in different crash logs, suggesting this may not directly relate to a specific file in my app. The crash occurs on production devices only and is not reproducible in development or testing environments. I’ve tried the following without success:
Has anyone encountered a similar issue? Could this be related to:
Any insights or troubleshooting suggestions would be greatly appreciated.
I have been battling this same issue for a year. I can confirm the following from my own tests and crashlytics reports:
My app relies heavily on foreground notifications that are likely present while the app is updated. Guessing that in some scenario the device is keeping a reference to the old remote views and then trying to update them after the layout IDs have changed with the new version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With