更新 Android sdk 后,提示 Couldn't expand RemoteViews

11163
2016-07-21 01:55 5.4k 0

更新极光sdk后,自己测试没有问题,但在bugly上爆了一个android.app.RemoteServiceException,
关于远程服务的通知只有极光用到了,网上查了关于这个异常的介绍,
说可能在自定义通知中可能用了remoteView不兼容的布局,但我发现布局没有问题,
还有说是每次要将notifition实例new出来,但通过极光又没法new。
所以请极光的大牛给看看这个问题。下满是异常信息,xml和自定义通知代码。

    android.app.RemoteServiceException
      Bad notification posted from package ----: Couldn't expand RemoteViews for:        
      StatusBarNotification(pkg=----- user=UserHandle{0} id=190054930 tag=null score=0 key=0|-  -----|190054930|null|10139: Notification(pri=0 contentView=-----/0x7f03009c vibrate=default   sound=default defaults=0xffffffff flags=0x10 color=0x00000000 vis=PRIVATE))
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1585)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:135)
    android.app.ActivityThread.main(ActivityThread.java:5669)
    java.lang.reflect.Method.invoke(Native Method)
    java.lang.reflect.Method.invoke(Method.java:372)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
代码:
//极光图标的适配
    CustomPushNotificationBuilder builder=new CustomPushNotificationBuilder(context,R.layout.my_push, R.id.iv_push, R.id.tv_title, R.id.tv_content);
 //   注释了     PendingIntent pendingintent = PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_CANCEL_CURRENT);


    builder.statusBarDrawable= R.drawable.app_icon_small;
   //最顶层状态栏小图标

    builder.layoutIconDrawable=R.drawable.app_icon_small_other;  
   //下拉状态时显示的通知图标.

    JPushInterface.setPushNotificationBuilder(2, builder);
    JPushInterface.setDefaultPushNotificationBuilder(builder); 
   //设置该对话框为默认.自定义消息:



 xml:

    `<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_in_hand"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<RelativeLayout
    android:id="@+id/rl_in_hand"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:paddingBottom="@dimen/dp10">

    <ImageView
        android:id="@+id/iv_push"
        android:layout_width="45dp"
        android:layout_height="45dp"
        android:layout_centerVertical="true"
        />


    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginBottom="@dimen/dp2"
        android:layout_marginLeft="@dimen/dp5"
        android:layout_toRightOf="@+id/iv_push"
        android:orientation="vertical">

        <TextView
            android:id="@+id/tv_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/dp2"
            android:text="智齿客服"
            android:textColor="@color/color_e4e4e4"
            android:textSize="@dimen/sp15" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dp2"
            android:orientation="horizontal">

            <TextView

                android:id="@+id/tv_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/dp2"
                android:layout_marginTop="@dimen/dp1"
                android:singleLine="true"
                android:text="fffffff时代"
                android:textColor="@color/color_999999"
                android:textSize="@dimen/sp13" />

        </LinearLayout>


    </LinearLayout>
</RelativeLayout>

`

1个回答

热门排序
  • 所有手机都会出现这个问题吗?我在网上看到 有开发者遇到类似的问题, I can never seem to reproduce the issue myself on a HTC Sensation or HTC One X which 展示全部