background_location icon indicating copy to clipboard operation
background_location copied to clipboard

app getting crashed when back button pressed and gives kotlin null pointer exception

Open rohitk1011 opened this issue 3 years ago • 2 comments

PlatformException(error, null, null, kotlin.KotlinNullPointerException I/flutter ( 2330): at com.almoullim.background_location.BackgroundLocationService.startLocationService(BackgroundLocationService.kt:105)

Fatal Exception: java.lang.RuntimeException: Unable to destroy activity {../..../MainActivity}: h.a at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4634) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4661) at android.app.ActivityThread.-wrap7(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1703) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Caused by h.a at com.almoullim.background_location.BackgroundLocationService.stopLocationService(BackgroundLocationService.java) at com.almoullim.background_location.BackgroundLocationService.setActivity(BackgroundLocationService.java) at com.almoullim.background_location.BackgroundLocationPlugin.onDetachedFromActivity(BackgroundLocationPlugin.java) at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.detachFromActivity(FlutterEngineConnectionRegistry.java) at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java) at io.flutter.embedding.android.FlutterActivity.release(FlutterActivity.java) at io.flutter.embedding.android.FlutterActivity.onDestroy(FlutterActivity.java) at android.app.Activity.performDestroy(Activity.java:7223) at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1161) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4621) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4661) at android.app.ActivityThread.-wrap7(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1703) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

rohitk1011 avatar Nov 12 '21 09:11 rohitk1011

Same problem here!

eduardo-and avatar Feb 03 '22 14:02 eduardo-and

Having the same issue. stopLocationService fails with NPE & crashes app if you ran startLocationService with forceAndroidLocationManager param set to true.

kenfoo avatar May 04 '22 16:05 kenfoo