Android 正在进行的通知RemoteServiceException-无法';t展开远程视图以进行:状态通知

Android 正在进行的通知RemoteServiceException-无法';t展开远程视图以进行:状态通知,android,Android,我已经点击了所有我能找到的关于这个问题的链接,但是没有一个是正确的 以下是全部错误: Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package my.package.name: Couldn't expand RemoteViews for: StatusBarNotification(pkg=my.package.name user=UserHandle{0} id=328

我已经点击了所有我能找到的关于这个问题的链接,但是没有一个是正确的

以下是全部错误:

Fatal Exception: android.app.RemoteServiceException: Bad notification posted from package my.package.name: Couldn't expand RemoteViews for: StatusBarNotification(pkg=my.package.name user=UserHandle{0} id=328 tag=null key=0|my.package.name|328|null|10243: Notification(pri=2 contentView=my.package.name/0x7f040049 vibrate=null sound=null defaults=0x0 flags=0x22 color=0x00000000 vis=PUBLIC semFlags=0x0 semPriority=0))
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1813)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:154)
   at android.app.ActivityThread.main(ActivityThread.java:6776)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
在我的搜索中,我了解到,当应用程序升级时,ID引用可能会发生变化,但这个错误似乎并不指向可绘制资源或类似的东西,看起来问题出在布局文件上,但我不确定问题出在哪里

下面是由contentView=[my.package.name]/0x7f040049定义的布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="65dp"
    android:background="@color/black"
    android:paddingBottom="8dp"
    android:paddingLeft="6dp"
    android:paddingRight="6dp"
    android:paddingTop="8dp">

    <ImageView
        android:id="@+id/notification_weather_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:adjustViewBounds="true"
        android:src="@drawable/notification_icon" />

    <TextView
        android:id="@+id/notification_weather_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginStart="5dp"
        android:layout_marginEnd="5dp"
        android:layout_toEndOf="@id/notification_weather_icon"
        android:layout_toRightOf="@id/notification_weather_icon"
        android:fontFamily="@string/roboto_thin"
        android:gravity="center"
        android:textColor="@color/white"
        android:textSize="35sp"
        tools:text="40*" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_toEndOf="@+id/notification_weather_text"
        android:layout_toRightOf="@+id/notification_weather_text"
        android:gravity="center_vertical"
        android:orientation="vertical">

        <RelativeLayout
            android:id="@+id/weather_type_layout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="2.5dp"
            android:layout_weight="1"
            android:gravity="bottom">

            <TextView
                android:id="@+id/notification_weather_type"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:ellipsize="end"
                android:fontFamily="@string/roboto_light"
                android:gravity="start|bottom"
                android:maxLines="1"
                android:maxWidth="200dp"
                android:minLines="1"
                android:textColor="@color/white"
                android:textSize="14sp"
                tools:text="Overcast" />

            <TextView
                android:id="@+id/notification_weather_location"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="16dp"
                android:layout_marginStart="16dp"
                android:layout_toEndOf="@id/notification_weather_type"
                android:layout_toRightOf="@id/notification_weather_type"
                android:ellipsize="end"
                android:fontFamily="@string/roboto"
                android:gravity="end|bottom"
                android:maxLines="2"
                android:minLines="1"
                android:minWidth="36dp"
                android:paddingBottom="1dp"
                android:textColor="@color/ongoing_notification_small_text_color"
                android:textSize="10sp"
                tools:text="San Fransisco" />


        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/weather_location_layout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:paddingTop="2dp">

            <TextView
                android:id="@+id/notification_weather_precip"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_toLeftOf="@+id/notification_weather_time"
                android:layout_toStartOf="@+id/notification_weather_time"
                android:fontFamily="@string/roboto"
                android:gravity="top|start"
                android:maxLines="1"
                android:minLines="1"
                android:textAllCaps="true"
                android:textColor="@color/ongoing_notification_small_text_color"
                android:textSize="10sp"
                tools:text="Precip 40%" />

            <TextView
                android:id="@+id/notification_weather_time"
                android:layout_width="56dp"
                android:layout_height="match_parent"
                android:layout_alignBaseline="@+id/notification_weather_precip"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="16dp"
                android:layout_marginStart="16dp"
                android:fontFamily="@string/roboto"
                android:gravity="top|end"
                android:maxLines="1"
                android:minLines="1"
                android:textColor="@color/ongoing_notification_small_text_color"
                android:textSize="@dimen/gallery_grid_update_time_text_size"
                tools:text="4.00pm" />
        </RelativeLayout>
    </LinearLayout>

</RelativeLayout>


如果您能帮助确定此问题的根源,我们将不胜感激

您是否已经找到了解决方案?我也遇到过同样的问题,但似乎只有在运行安卓7.0的三星手机上出现过。不幸的是,没有。仍然希望有一天能找到关于这个问题的消息吗?看起来Chromium团队也有类似的问题,听起来像是一个特定于设备的实现错误。我建议在代码隐藏中设置资源,如果找不到资源,则捕获异常。