flutter_background_service icon indicating copy to clipboard operation
flutter_background_service copied to clipboard

RuntimeException: Unable to stop service

Open tinyCoder32 opened this issue 2 years ago • 10 comments
trafficstars

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

tinyCoder32 avatar Oct 19 '23 16:10 tinyCoder32

same!

Abdullatif-Eida avatar Oct 19 '23 16:10 Abdullatif-Eida

I'm getting this also.

ScottAtRedHawk avatar Oct 19 '23 18:10 ScottAtRedHawk

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

Abdullatif-Eida avatar Oct 20 '23 06:10 Abdullatif-Eida

same !

MohamedHassan1311 avatar Oct 29 '23 14:10 MohamedHassan1311

same

qq837890739 avatar Oct 30 '23 10:10 qq837890739

Obtengo el mismo error , no encunetro la forma de solucionarlo

CarlosBernalA avatar Oct 31 '23 21:10 CarlosBernalA

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

HoangNgocAnh9797tb avatar Nov 15 '23 08:11 HoangNgocAnh9797tb

same !

RaminBgrn avatar Jan 17 '24 17:01 RaminBgrn

For me it happens when I use another package (like flutter_v2ray) at the same time, it's a conflict!

mmeyahi avatar Jan 21 '24 20:01 mmeyahi

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

RaminBgrn avatar Jan 22 '24 09:01 RaminBgrn