X-SLAYER / notification_listener_service

Flutter plugin to listen to all incoming notifications (posted or removed) with the possibility to reply to them
https://pub.dev/packages/notification_listener_service
MIT License
19 stars 24 forks source link

ClassCastException - VectorDrawable cannot be cast to BitmapDrawable #24

Open imdul opened 2 months ago

imdul commented 2 months ago

I don’t see this notification, I just get an error.

W/System.err(30401): java.lang.ClassCastException: android.graphics.drawable.VectorDrawable cannot be cast to android.graphics.drawable.BitmapDrawable
W/System.err(30401):    at notification.listener.service.NotificationListener.getNotificationLargeIcon(NotificationListener.java:110)
W/System.err(30401):    at notification.listener.service.NotificationListener.handleNotification(NotificationListener.java:54)
W/System.err(30401):    at notification.listener.service.NotificationListener.onNotificationPosted(NotificationListener.java:36)
W/System.err(30401):    at android.service.notification.NotificationListenerService.onNotificationPosted(NotificationListenerService.java:347)
W/System.err(30401):    at android.service.notification.NotificationListenerService$MyHandler.handleMessage(NotificationListenerService.java:2062)
W/System.err(30401):    at android.os.Handler.dispatchMessage(Handler.java:107)
W/System.err(30401):    at android.os.Looper.loop(Looper.java:237)
W/System.err(30401):    at android.app.ActivityThread.main(ActivityThread.java:8167)
W/System.err(30401):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(30401):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
W/System.err(30401):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
D/ERROR LARGE ICON(30401): getNotificationLargeIcon: android.graphics.drawable.VectorDrawable cannot be cast to android.graphics.drawable.BitmapDrawable
W/System.err(15270): android.content.pm.PackageManager$NameNotFoundException: com.google.android.setupwizard
W/System.err(15270):    at android.app.ApplicationPackageManager.getApplicationInfoAsUser(ApplicationPackageManager.java:423)
W/System.err(15270):    at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:412)
W/System.err(15270):    at android.app.ApplicationPackageManager.getApplicationIcon(ApplicationPackageManager.java:1506)
W/System.err(15270):    at notification.listener.service.NotificationListener.getAppIcon(NotificationListener.java:92)
W/System.err(15270):    at notification.listener.service.NotificationListener.handleNotification(NotificationListener.java:49)
W/System.err(15270):    at notification.listener.service.NotificationListener.onNotificationPosted(NotificationListener.java:36)
W/System.err(15270):    at android.service.notification.NotificationListenerService.onNotificationPosted(NotificationListenerService.java:374)
W/System.err(15270):    at android.service.notification.NotificationListenerService$MyHandler.handleMessage(NotificationListenerService.java:2131)
W/System.err(15270):    at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err(15270):    at android.os.Looper.loop(Looper.java:223)
W/System.err(15270):    at android.app.ActivityThread.main(ActivityThread.java:7656)
W/System.err(15270):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(15270):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
W/System.err(15270):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/Icon    (15270): Unable to find pkg=com.google.android.setupwizard for icon Icon(typ=RESOURCE pkg=com.google.android.setupwizard id=0x7f0800e8)
E/Icon    (15270): android.content.pm.PackageManager$NameNotFoundException: com.google.android.setupwizard
E/Icon    (15270):  at android.app.ApplicationPackageManager.getApplicationInfoAsUser(ApplicationPackageManager.java:423)
E/Icon    (15270):  at android.app.ApplicationPackageManager.getApplicationInfo(ApplicationPackageManager.java:412)
E/Icon    (15270):  at android.graphics.drawable.Icon.loadDrawableInner(Icon.java:366)
E/Icon    (15270):  at android.graphics.drawable.Icon.loadDrawable(Icon.java:334)
E/Icon    (15270):  at notification.listener.service.NotificationListener.getNotificationLargeIcon(NotificationListener.java:109)
E/Icon    (15270):  at notification.listener.service.NotificationListener.handleNotification(NotificationListener.java:54)
E/Icon    (15270):  at notification.listener.service.NotificationListener.onNotificationPosted(NotificationListener.java:36)
E/Icon    (15270):  at android.service.notification.NotificationListenerService.onNotificationPosted(NotificationListenerService.java:374)
E/Icon    (15270):  at android.service.notification.NotificationListenerService$MyHandler.handleMessage(NotificationListenerService.java:2131)
E/Icon    (15270):  at android.os.Handler.dispatchMessage(Handler.java:106)
E/Icon    (15270):  at android.os.Looper.loop(Looper.java:223)
E/Icon    (15270):  at android.app.ActivityThread.main(ActivityThread.java:7656)
E/Icon    (15270):  at java.lang.reflect.Method.invoke(Native Method)
E/Icon    (15270):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/Icon    (15270):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
W/System.err(15270): java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()' on a null object reference
W/System.err(15270):    at notification.listener.service.NotificationListener.getNotificationLargeIcon(NotificationListener.java:110)
W/System.err(15270):    at notification.listener.service.NotificationListener.handleNotification(NotificationListener.java:54)
W/System.err(15270):    at notification.listener.service.NotificationListener.onNotificationPosted(NotificationListener.java:36)
W/System.err(15270):    at android.service.notification.NotificationListenerService.onNotificationPosted(NotificationListenerService.java:374)
W/System.err(15270):    at android.service.notification.NotificationListenerService$MyHandler.handleMessage(NotificationListenerService.java:2131)
W/System.err(15270):    at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err(15270):    at android.os.Looper.loop(Looper.java:223)
W/System.err(15270):    at android.app.ActivityThread.main(ActivityThread.java:7656)
W/System.err(15270):    at java.lang.reflect.Method.invoke(Native Method)
W/System.err(15270):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
W/System.err(15270):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
D/ERROR LARGE ICON(15270): getNotificationLargeIcon: Attempt to invoke virtual method 'android.graphics.Bitmap android.graphics.drawable.BitmapDrawable.getBitmap()' on a null object reference
Juttu commented 1 month ago

Hey, did you find a solution for this problem ?

X-SLAYER commented 1 month ago

what are the steps to reproduce please