Open Ellynnn opened 10 months ago
I had the same issue and i fixed with downgrade flutter_background_service_android to version 6.0.1.
flutter pub downgrade flutter_background_service_android
I know it is a temporary solution but better than nothing :)
Preveously it was working , but now I got same issue.
I have the same problem.
Info:
flutter_background_service: ^5.0.2
bool isServiceRunning = await FlutterBackgroundService().isRunning();
`[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method isServiceRunning on channel id.flutter/background_service/android/method)
Same here, any updates?
@ekasetiawans same issue, any updates?
Everyone please check pr #392 . I have proposed a solution. Cheers, Thanks.
Its might you are accesing method from the background service isolate that only available for main isolate. For example, you starting service, from the onStart method or any api calls to the FlutterBakcgroundService class directly. You should only call apis that available for serviceInstance.
But I am just running the main.dart given in package example. Still getting the same exception.
But I am just running the main.dart given in package example. Still getting the same exception.
I have re-checked it's the example project run normally in my side.
But I am just running the main.dart given in package example. Still getting the same exception.
I also have this error :
Launching lib/main.dart on Nexus 5 in debug mode...
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
V/BackgroundService(26354): Starting flutter engine for background service
V/BackgroundService(26354): Service already running, using existing service
I/flutter (26354): `flutter_background_service_android` threw an error: Exception: This class should only be used in the main isolate (UI App). The app may not function as expected until you remove this plugin from pubspec.yaml
Same issue
same issue
same here
same issue, any workaround?
same issue
same issue
same issue
same issue
same issue flutter_background_service_android` threw an error: This class should only be used in the main isolate (UI App). The app may not function as expected until you remove this plugin from pubspec.yaml
same issue as @AwaisQazii on android 12
same issue
@pragma('vm:entry-point') void onStart(ServiceInstance service) async { // Only available for flutter 3.0.0 and later DartPluginRegistrant.ensureInitialized(); <<---remove this code, will not throw exceptions
// For flutter prior to version 3.0.0 // We have to register the plugin manually
SharedPreferences preferences = await SharedPreferences.getInstance(); ... }
seems run twice?
I got same issue on 5.0.5
I have the same issue. @yanllllk's solution seems to work but I'm not sure if it's safe to use?
same issue flutter_background_service_android` threw an error: This class should only be used in the main isolate (UI App). The app may not function as expected until you remove this plugin from pubspec.yaml
I am facing the same issue but when I try to Turn On the "Manage Notification" manually, It is showing me that notification as well as it is updating the data based on the interval.
Take a look it it can help you. I don't know whether I'll get any issues in the future or not.
Update: As suggested by @yanllllk I've removed that line and it's not showing that warning anymore in logs.
same issue and soultion?
i have the same issue
Just add two lines to your pubspec.yaml file:
flutter_background_service: any flutter_background_service_android: "6.0.1"
This worked for me. I know this simply downgrades the flutter_background_service_android package and adjusts flutter_background_service accordingly. However, until this issue is fixed in the future, this solution should suffice.
It is breaking the background service in 6.2.3. App no longer works in the background after throwing this error Exception: This class should only be used in the main isolate (UI App)
Device - Pixel 6a
flutter_background_service_android
threw an error: Exception: This class should only be used in the main isolate (UI App). The app may not function as expected until you remove this plugin from pubspec.yaml
[✓] Flutter (Channel stable, 3.19.4, on macOS 14.4.1 23E224 darwin-x64, locale en-IN) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [!] Xcode - develop for iOS and macOS ✗ Xcode installation is incomplete; a full installation is necessary for iOS and macOS development. Download at: https://developer.apple.com/xcode/ Or install Xcode via the App Store. Once installed, run: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer sudo xcodebuild -runFirstLaunch [✓] Chrome - develop for the web [✓] Android Studio (version 2023.3) [✓] VS Code (version 1.89.1) [✓] Connected device (3 available) [✓] Network resources
@pragma('vm:entry-point') void onStart(ServiceInstance service) async { // Only available for flutter 3.0.0 and later DartPluginRegistrant.ensureInitialized(); <<---remove this code, will not throw exceptions
// For flutter prior to version 3.0.0 // We have to register the plugin manually
SharedPreferences preferences = await SharedPreferences.getInstance(); ... }
seems run twice?
Me ajudou! Obrigado @yanllllk !
same issue
Whenever I build the app, I keep getting the below line in my debug console.
I tried removing the flutter_background_service_android package from the dependency but the same line of message still prompts. However, the app is still able to build. Can I know how to fix this?