rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
288 stars 328 forks source link

[ANDROID] Crash caused by java.lang.IllegalArgumentException #268

Open Wian-TMC opened 3 years ago

Wian-TMC commented 3 years ago

Background locator fails to start on some Android 10 device apparent invalid notification argument for small icon. Here are the logs:

Fatal Exception: java.lang.RuntimeException: Unable to create service rekab.app.background_locator.IsolateHolderService: java.lang.IllegalStateException: FlutterCallbackInformati…formation(callbackHandle) must not be null
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:3394)
       at android.app.ActivityThread.-wrap4(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1711)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6552)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
Caused by java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=app.rekab/locator_plugin pri=1 contentView=null vibrate=null sound=null defaults=0x0 flags=0xa color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)
       at android.app.NotificationManager.fixNotification(NotificationManager.java:537)
       at android.app.NotificationManager.notifyAsUser(NotificationManager.java:516)
       at android.app.NotificationManager.notify(NotificationManager.java:449)
       at android.app.NotificationManager.notify(NotificationManager.java:425)
       at rekab.app.background_locator.IsolateHolderService.updateNotification(IsolateHolderService.java:90)
       at rekab.app.background_locator.IsolateHolderService.onStartCommand(IsolateHolderService.java:59)
       at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4288)
       at android.app.ActivityThread.access$1800(ActivityThread.java:268)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2014)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:7814)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
mehdok commented 2 years ago

Hi @Wian-TMC Thank you for opening an issue;

Did you provide an icon or used the default one?

Wian-TMC commented 2 years ago

My notification icon is set to an empty string

notificationIcon: '',
mehdok commented 2 years ago

Can you provide a valid icon and see if the error persists or not?

Wian-TMC commented 2 years ago

Sure.

hieudz commented 2 years ago

I got the same issue. The error still persist even with a valid icon