开发自定义 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
参考:
|
|