Android App crashed, when registering geofence. Issue was that lateinit variable (sPluginRegistrantCallback) was accessing before initialization. So added safety checks for all lateinit variables and it resolved.
Error:
E/AndroidRuntime(23524): java.lang.RuntimeException: Unable to create service io.flutter.plugins.geofencing.GeofencingService: kotlin.UninitializedPropertyAccessException: lateinit property sPluginRegistrantCallback has not been initialized
E/AndroidRuntime(23524): at android.app.ActivityThread.handleCreateService(ActivityThread.java:3966)
E/AndroidRuntime(23524): at android.app.ActivityThread.access$1500(ActivityThread.java:220)
E/AndroidRuntime(23524): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876)
E/AndroidRuntime(23524): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(23524): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime(23524): at android.app.ActivityThread.main(ActivityThread.java:7397)
E/AndroidRuntime(23524): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(23524): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime(23524): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
E/AndroidRuntime(23524): Caused by: kotlin.UninitializedPropertyAccessException: lateinit property sPluginRegistrantCallback has not been initialized
E/AndroidRuntime(23524): at io.flutter.plugins.geofencing.GeofencingService.startGeofencingService(GeofencingService.kt:70)
E/AndroidRuntime(23524): at io.flutter.plugins.geofencing.GeofencingService.onCreate(GeofencingService.kt:116)
E/AndroidRuntime(23524): at android.app.ActivityThread.handleCreateService(ActivityThread.java:3954)
E/AndroidRuntime(23524): ... 8 more
I/Process (23524): Sending signal. PID: 23524 SIG: 9
Sorry for the delay on this. I think a large portion of this change may no longer be applicable after migrating to the Android v2 embedding. Closing for now, but please let me know if that's not the case.
Flutter Channel: Stable FlutterGeofencing Branch : Master [1da0841]
Android App crashed, when registering geofence. Issue was that lateinit variable (sPluginRegistrantCallback) was accessing before initialization. So added safety checks for all lateinit variables and it resolved.
Error: E/AndroidRuntime(23524): java.lang.RuntimeException: Unable to create service io.flutter.plugins.geofencing.GeofencingService: kotlin.UninitializedPropertyAccessException: lateinit property sPluginRegistrantCallback has not been initialized E/AndroidRuntime(23524): at android.app.ActivityThread.handleCreateService(ActivityThread.java:3966) E/AndroidRuntime(23524): at android.app.ActivityThread.access$1500(ActivityThread.java:220) E/AndroidRuntime(23524): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1876) E/AndroidRuntime(23524): at android.os.Handler.dispatchMessage(Handler.java:107) E/AndroidRuntime(23524): at android.os.Looper.loop(Looper.java:214) E/AndroidRuntime(23524): at android.app.ActivityThread.main(ActivityThread.java:7397) E/AndroidRuntime(23524): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(23524): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/AndroidRuntime(23524): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) E/AndroidRuntime(23524): Caused by: kotlin.UninitializedPropertyAccessException: lateinit property sPluginRegistrantCallback has not been initialized E/AndroidRuntime(23524): at io.flutter.plugins.geofencing.GeofencingService.startGeofencingService(GeofencingService.kt:70) E/AndroidRuntime(23524): at io.flutter.plugins.geofencing.GeofencingService.onCreate(GeofencingService.kt:116) E/AndroidRuntime(23524): at android.app.ActivityThread.handleCreateService(ActivityThread.java:3954) E/AndroidRuntime(23524): ... 8 more I/Process (23524): Sending signal. PID: 23524 SIG: 9