background_locator icon indicating copy to clipboard operation
background_locator copied to clipboard

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

Open Wian-TMC opened this issue 3 years ago • 5 comments

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)

Wian-TMC avatar Aug 11 '21 11:08 Wian-TMC

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

  • Make sure you have global callback function;
  • Please add some breakpoints around this line to see if you can catch more information about the null field; https://github.com/rekab-app/background_locator/blob/b2fcb125001796f186189cbca970782da244c8f6/android/src/main/kotlin/rekab/app/background_locator/IsolateHolderExtension.kt#L26

mehdok avatar Sep 11 '21 13:09 mehdok

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.

Wian-TMC avatar Sep 12 '21 12:09 Wian-TMC

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;

mehdok avatar Sep 12 '21 12:09 mehdok

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

Wian-TMC avatar Sep 12 '21 12:09 Wian-TMC

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

argo1 avatar Oct 02 '21 10:10 argo1