AndroidRuntime: android.app.RemoteServiceException: Bad notification posted from package


在使用RemoteView創建自定義通知視圖的時候一啟動通知欄應用就停止運行。

查看錯誤提示,開始時為

StatusBar: Caused by: android.content.res.Resources$NotFoundException: File res/drawable/fm_statusbar_clear.xml from drawable resource ID #0x7f02003f

找不到資源,調整了使用方法后又出現了

04-11 18:54:27.542 21850 21850 E AndroidRuntime: android.app.RemoteServiceException: Bad notification posted from package com.xxx.yyy: Couldn't create icon: StatusBarIcon(pkg=com.xxx.yyyuser=0 id=0x7f020059 level=0 visible=true num=0 )
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:102)
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:135)
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5258)
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Method.java:372)
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
04-11 18:54:27.542 21850 21850 E AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:702)

 

原因是缺少這個分辨率的Drawable資源。之前適配的時候只適配了1080分辨率的,而新的機型是720分辨率的。因此造成了上述錯誤。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM