I'm seeing the following exception in crash logs:
android.app.RemoteServiceException: Bad notification posted from package XXX: Couldn't inflate contentViewsandroid.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class com.google.android.material.appbar.AppBarLayout
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
But, my custom notification layout has never defined this class label:com.google.android.material.appbar.AppBarLayout
Moreover, my custom layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/local_push_bg_color"
android:orientation="vertical"
android:padding="@dimen/dp_6">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_26">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:drawableStart="@drawable/ic_local_push_logo"
android:drawablePadding="@dimen/dp_6"
android:maxLines="1"
android:textStyle="bold"
android:textColor="@color/local_push_title_text_color"
android:text="@string/local_push_title"
android:textSize="@dimen/sp_14"
tools:ignore="RelativeOverlap" />
<ImageView
android:id="@+id/iv_next"
android:layout_width="@dimen/dp_26"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_local_push_next"
tools:ignore="ContentDescription" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/v_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1">
<ImageView
android:id="@+id/iv_push_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
tools:ignore="ContentDescription" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/shape_bg_local_push_content" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/ic_local_push_play" />
<TextView
android:id="@+id/tv_push_content_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/dp_10"
android:ellipsize="end"
android:textStyle="bold"
android:maxLines="2"
tools:text="asdaksjdllasfjasldjkasfljkaslkfjlsjafsafjk"
android:textColor="@color/c_white"
android:textSize="@dimen/sp_14" />
</RelativeLayout>
<LinearLayout
android:id="@+id/v_search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/shape_bg_local_push_search"
android:orientation="horizontal"
android:padding="@dimen/dp_8">
<TextView
android:id="@+id/tv_push_search_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawableStart="@drawable/ic_local_push_search"
android:drawablePadding="@dimen/dp_6"
android:ellipsize="end"
android:maxLines="1"
tools:text="what the fk"
android:textColor="@color/local_push_search_text_color"
android:textSize="@dimen/sp_12" />
</LinearLayout>
</LinearLayout>
as you see, There is no class label reported above.
So far, we have found three different error messages for the same custom notification layout:
- Error inflating class com.google.android.material.appbar.AppBarLayout
- Error inflating class android.support.design.widget.AppBarLayout
- Error inflating class android.widget.TextView