Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从包中发布的错误通知_Android_Notifications - Fatal编程技术网

Android 从包中发布的错误通知

Android 从包中发布的错误通知,android,notifications,Android,Notifications,我想为我使用此代码的用户创建自定义通知 RemoteViews remoteViews; Intent intent; NotificationCompat.Builder builder; PendingIntent pIntent; intent = new Intent(context, SarinaHome.class); pIntent = PendingIntent.getActivity(context, 0, intent,

我想为我使用此代码的用户创建自定义通知

RemoteViews remoteViews;
Intent intent;
NotificationCompat.Builder builder;
PendingIntent pIntent;

intent = new Intent(context, SarinaHome.class);
            pIntent = PendingIntent.getActivity(context, 0, intent,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            remoteViews = new RemoteViews(context.getPackageName(),
                    R.layout.custom_notification);

            builder = new NotificationCompat.Builder(context)
                    // Set Icon
                    .setSmallIcon(R.drawable.ic_launcher)
                            // Set Ticker Message
                    .setTicker(context.getString(R.string.app_name))
                            // Dismiss Notification
                    .setAutoCancel(true)
                            // Set PendingIntent into Notification
                    .setContentIntent(pIntent)
                            // Set RemoteViews into Notification
                    .setContent(remoteViews);
            remoteViews.setTextViewText(R.id.message_custom_notification,message+ context.getString(R.string.havenewmessage));



NotificationManager notificationmanager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);     


notificationmanager.notify(1130, builder.build());
但我给出了以下错误信息:

Process: com.rad.sarina, PID: 12557
    android.app.RemoteServiceException: Bad notification posted from package com.rad.sarina: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.rad.sarina user=UserHandle{0} id=1130 tag=null score=0: Notification(pri=0 icon=7f0200b3 contentView=com.rad.sarina/0x7f030024 vibrate=null sound=null defaults=0x0 flags=0x10 when=1438512821851 ledARGB=0x0 contentIntent=Y deleteIntent=N contentTitle=N contentText=N tickerText=6 kind=[null]))
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1453)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5479)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
            at dalvik.system.NativeStart.main(Native Method)      
奇怪的是,这段代码很早就开始工作了,但今天没有了。

有人能帮我吗?

我发现了我的问题,但问题不在我的问题“抱歉”中。
我在自定义通知中使用滚动视图,但在自定义通知“我不知道为什么可能与状态菜单滚动混淆”中无法使用滚动视图。
因此,不要在自定义通知中使用滚动视图

Notification(pri=2 contentView=com.android.incallui/0x7f04009e vibrate=null
sound=null defaults=0x0 flags=0x2 color=0x00000000 originalPackageName=N originalUserId=0
vis=PRIVATE publicVersion=Notification(pri=0 contentView=com.android.incallui/0x7f0400aa 
vibrate=null sound=null defaults=0x0 flags=0x10 color=0x00000000 originalPackageName=N 
originalUserId=0 vis=PUBLIC))
异常android.app.RemoteServiceException:发布了错误通知 从包com.xxxx:无法展开以下项的RemoteView: StatusBarNotification(pkg=com.swazer.smares user=UserHandle{0}id=1 tag=null分数=0:通知(pri=0图标=7f0201aa contentView=com.swazer.smares/0x1090069振动=null声音=null 当=149816158616 ledARGB=0x0 contentIntent=Y时,默认值=0x0标志=0x10 deleteIntent=N contentTitle=13 contentText=53 tickerText=N kind=[null] (2项行动)


vectorDrawables
添加到通知中,这是一个相同的例外,我将ti更改为图像png,效果很好

您需要向我们展示您的
自定义通知
布局。这里面可能有个问题。