rekabhq / background_locator

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

[ANDROID] java.lang.IllegalStateException: FlutterCallbackInformati…formation(callbackHandle) must not be null #265

Open Wian-TMC opened 3 years ago

Wian-TMC commented 3 years ago

Causes many crashes on android. Here are the crash 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:3484)
       at android.app.ActivityThread.-wrap4(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1702)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6710)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

 Caused by java.lang.IllegalStateException: FlutterCallbackInformati…formation(callbackHandle) must not be null
       at rekab.app.background_locator.IsolateHolderExtensionKt.startLocatorService(IsolateHolderExtensionKt.java:58)
       at rekab.app.background_locator.IsolateHolderService.onCreate(IsolateHolderService.java:3)
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:3474)
       at android.app.ActivityThread.-wrap4(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1702)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6710)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
mehdok commented 2 years ago

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

Wian-TMC commented 2 years ago

My callback is a static void function within a global scope of a helper class. So I think some more digging is necessary to get to the bottom of this issue. The issue happens quite randomly on different devices, so testing with breakpoints and hoping it breaks may take some time.

mehdok commented 2 years ago

Recently I can see lots of issues relating to FlutterCallbackInformation. So there might be something wrong with that. I'll try to dig a little and read some documents about it, I also appreciate any help and suggestion;

Wian-TMC commented 2 years ago

Could be. Some flutter engine updates do include unknown breaking changes

argo1 commented 2 years ago

Might be related to #264 . Callback value is Int not Long and it ends up as NULL because of ?.