android - Bad notification posted - Couldn't expand RemoteViews for: StatusBarNotification

开发自定义 notification时,遇到这样的错误:

05-06 08:52:27.964 4801-4801/com.example.vulcan.notification I/art: Not late-enabling -Xcheck:jni (already on)
05-06 08:52:28.055 4801-4801/com.example.vulcan.notification W/System: ClassLoader referenced unknown path: /data/app/com.example.vulcan.notification-1/lib/x86
05-06 08:52:28.152 4801-4816/com.example.vulcan.notification D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-06 08:52:28.271 4801-4816/com.example.vulcan.notification I/OpenGLRenderer: Initialized EGL, version 1.4
05-06 08:52:28.334 4801-4816/com.example.vulcan.notification W/EGL_emulation: eglSurfaceAttrib not implemented
05-06 08:52:28.334 4801-4816/com.example.vulcan.notification W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xabf0c220, error=EGL_SUCCESS
05-06 08:52:28.984 4801-4801/com.example.vulcan.notification I/Choreographer: Skipped 37 frames!  The application may be doing too much work on its main thread.
05-06 08:53:17.209 4801-4801/com.example.vulcan.notification D/main_avtivity: onClick: 
05-06 08:53:17.258 4801-4801/com.example.vulcan.notification D/AndroidRuntime: Shutting down VM
05-06 08:53:17.261 4801-4801/com.example.vulcan.notification E/AndroidRuntime: FATAL EXCEPTION: main
                                                                               Process: com.example.vulcan.notification, PID: 4801
                                                                               android.app.RemoteServiceException: Bad notification posted from package com.example.vulcan.notification: Couldn't expand RemoteViews for: StatusBarNotification(pkg=com.example.vulcan.notification user=UserHandle{0} id=1 tag=null score=0 key=0|com.example.vulcan.notification|1|null|10063: Notification(pri=0 contentView=com.example.vulcan.notification/0x7f040030 vibrate=null sound=null tick defaults=0x0 flags=0x10 color=0x00000000 vis=PRIVATE))
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1507)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                   at android.os.Looper.loop(Looper.java:148)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                   at java.lang.reflect.Method.invoke(Native Method)
                                                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-06 08:53:19.303 4801-4801/? I/Process: Sending signal. PID: 4801 SIG: 9


可能的原因是

(1)layout布局不对;

(2)定义布局里面有不合适的component;

在RemoteViews这种调用方式中,你只能使用以下几种界面组件:
Layout:
    FrameLayout, LinearLayout, RelativeLayout

Component:
  AnalogClock, Button, Chronometer, ImageButton, ImageView, ProgressBar, TextView, ViewFlipper, ListView, GridView, StackView, AdapterViewFlipper

参考:



  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值