TL;DR
When using Firebases ability to set notification, use a PNG instead of a vector by setting default_notification_icon
in AndroidManifest.xml
Long description
We had the problem when receiving push notifications on a LG G2 with Android 4.4.2
Fabric (and catlog) showed the following stack trace:
Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package de.xxx.xxx: Couldn't create icon: StatusBarIcon(pkg=de.xxx.xxx=0 id=0x7f0200a6 level=0 visible=true num=0 )
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5105)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(NativeStart.java)
Notice, there is no class in stack trace matching our package. Also, onMessageReceived
was called (checked not only with debug break point but also Log.e(TAG, "...")
).
This means, that it's not us setting the notification, it is Firebase SDK.
Since there is no code involved, I figured (after painful hours of head banging) error must be in AndroidManifest.xml.
We are setting another notification icon with the following snippet:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
Here, @drawable/ic_notification
was a vector drawable (SVG). I changed it to a PNG and the crash was gone.