flutter_background_service
flutter_background_service copied to clipboard
RuntimeException: Unable to stop service
Hello, after the latest update I am getting this on Android, and the app is crashing:
E/AndroidRuntime( 6322): java.lang.RuntimeException: Unable to stop service id.flutter.flutter_background_service.BackgroundService@135f0c3: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.setMethodCallHandler(io.flutter.plugin.common.MethodChannel$MethodCallHandler)' on a null object reference
E/AndroidRuntime( 6322): at android.app.ActivityThread.handleStopService(ActivityThread.java:4870)
E/AndroidRuntime( 6322): at android.app.ActivityThread.-$$Nest$mhandleStopService(Unknown Source:0)
E/AndroidRuntime( 6322): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2297)
E/AndroidRuntime( 6322): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 6322): at android.os.Looper.loopOnce(Looper.java:205)
E/AndroidRuntime( 6322): at android.os.Looper.loop(Looper.java:294)
E/AndroidRuntime( 6322): at android.app.ActivityThread.main(ActivityThread.java:8176)
E/AndroidRuntime( 6322): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 6322): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/AndroidRuntime( 6322): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/AndroidRuntime( 6322): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.setMethodCallHandler(io.flutter.plugin.common.MethodChannel$MethodCallHandler)' on a null object reference
E/AndroidRuntime( 6322): at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestorePlugin.onDetachedFromEngine(FlutterFirebaseFirestorePlugin.java:132)
E/AndroidRuntime( 6322): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:272)
E/AndroidRuntime( 6322): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:282)
E/AndroidRuntime( 6322): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.removeAll(FlutterEngineConnectionRegistry.java:290)
E/AndroidRuntime( 6322): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.destroy(FlutterEngineConnectionRegistry.java:123)
E/AndroidRuntime( 6322): at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java:460)
E/AndroidRuntime( 6322): at id.flutter.flutter_background_service.BackgroundService.onDestroy(BackgroundService.java:119)
E/AndroidRuntime( 6322): at android.app.ActivityThread.handleStopService(ActivityThread.java:4850)
E/AndroidRuntime( 6322): ... 9 more
same!
I'm getting this also.
I fixed the issue by updating flutter just be sure to make flutter upgrade than flutter doctor and it should work
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.13.8, on macOS 12.6.8 21G725 darwin-x64, locale en-TR) [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) [✓] Xcode - develop for iOS and macOS (Xcode 14.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.82.3) [✓] Connected device (4 available) [✓] Network resources
and make sure you have the last version flutter_background_service 5.0.2
same !
same
Obtengo el mismo error , no encunetro la forma de solucionarlo
E/AndroidRuntime(24963): java.lang.RuntimeException: Unable to stop service id.flutter.flutter_background_service.BackgroundService@93ed545: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.setMethodCallHandler(io.flutter.plugin.common.MethodChannel$MethodCallHandler)' on a null object reference E/AndroidRuntime(24963): at android.app.ActivityThread.handleStopService(ActivityThread.java:4790) E/AndroidRuntime(24963): at android.app.ActivityThread.access$2000(ActivityThread.java:301) E/AndroidRuntime(24963): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2191) E/AndroidRuntime(24963): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(24963): at android.os.Looper.loop(Looper.java:246) E/AndroidRuntime(24963): at android.app.ActivityThread.main(ActivityThread.java:8512) E/AndroidRuntime(24963): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(24963): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) E/AndroidRuntime(24963): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130) E/AndroidRuntime(24963): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.setMethodCallHandler(io.flutter.plugin.common.MethodChannel$MethodCallHandler)' on a null object reference E/AndroidRuntime(24963): at com.deepar.ai.DeepArPlugin.onDetachedFromEngine(DeepArPlugin.java:397) E/AndroidRuntime(24963): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:272) E/AndroidRuntime(24963): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.remove(FlutterEngineConnectionRegistry.java:282) E/AndroidRuntime(24963): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.removeAll(FlutterEngineConnectionRegistry.java:290) E/AndroidRuntime(24963): at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.destroy(FlutterEngineConnectionRegistry.java:123) E/AndroidRuntime(24963): at io.flutter.embedding.engine.FlutterEngine.destroy(FlutterEngine.java:460) E/AndroidRuntime(24963): at id.flutter.flutter_background_service.BackgroundService.onDestroy(BackgroundService.java:121) E/AndroidRuntime(24963): at android.app.ActivityThread.handleStopService(ActivityThread.java:4770) E/AndroidRuntime(24963): ... 8 more W/umpearl.idolis(24963): Attempt to remove non-JNI local reference, dumping thread Please fix
same !
For me it happens when I use another package (like flutter_v2ray) at the same time, it's a conflict!
For me it happens when I use another package (like flutter_v2ray) at the same time, it's a conflict!
Exactly .. When you use a package that uses the background service, it may cause interference and null exception