I created a new project and integrated this plugin and it worked fine . But i inserted it into an existing project with some plugins which include firebase plugins....When ever i try to run periodicTaskFun i get the error below:
D/EGL_emulation( 9082): eglCreateContext: 0x8941c020: maj 2 min 0 rcv 2
D/EGL_emulation( 9082): eglCreateContext: 0x8941c5c0: maj 2 min 0 rcv 2
D/ ( 9082): HostConnection::get() New Host Connection established 0x8e28ecc0, tid 9153
D/EGL_emulation( 9082): eglMakeCurrent: 0x8941c5c0: ver 2 0 (tinfo 0x862ff6e0)
E/BluetoothAdapter( 9082): Bluetooth binder is null
W/FlutterEnginePluginRegistry( 9082): Attempted to register plugin (io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry$ShimRegistrarAggregate@be7922c) but it was already registered with this FlutterEngine (io.flutter.embedding.engine.FlutterEngine@a2ad4f5).
E/MethodChannel#( 9082): Parameter messenger must not be null.
D/AndroidRuntime( 9082): Shutting down VM
E/AndroidRuntime( 9082): FATAL EXCEPTION: main
E/AndroidRuntime( 9082): Process: com.couriax.driver, PID: 9082
E/AndroidRuntime( 9082): java.lang.RuntimeException: Unable to start service com.saywut.flutter_foreground_service_plugin.FlutterForegroundService@92d0fb with Intent { act=START_FOREGROUND_TASK cmp=com.couriax.driver/com.saywut.flutter_foreground_service_plugin.FlutterForegroundService }: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
E/AndroidRuntime( 9082): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3491)
E/AndroidRuntime( 9082): at android.app.ActivityThread.-wrap20(Unknown Source:0)
E/AndroidRuntime( 9082): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime( 9082): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime( 9082): at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime( 9082): at android.app.ActivityThread.main(ActivityThread.java:6494)
E/AndroidRuntime( 9082): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9082): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/AndroidRuntime( 9082): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/AndroidRuntime( 9082): Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
E/AndroidRuntime( 9082): at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:119)
E/AndroidRuntime( 9082): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundServicePlugin.setupChannels(FlutterForegroundServicePlugin.java:42)
E/AndroidRuntime( 9082): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundServicePlugin.registerWith(FlutterForegroundServicePlugin.java:22)
E/AndroidRuntime( 9082): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundService.createFlutterEngineAndBackgroundChannel(FlutterForegroundService.java:220)
E/AndroidRuntime( 9082): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundService.onStartCommand(FlutterForegroundService.java:95)
E/AndroidRuntime( 9082): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3474)
E/AndroidRuntime( 9082): ... 8 more
will be glad if i could get help.
MY FLUTTER DOCTOR
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
• Flutter version 1.22.5 at C:\src\flutter
• Framework revision 7891006299 (2 months ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Jo\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = C:\Users\Jo\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[!] VS Code (version 1.52.1)
• VS Code at C:\Users\Jo\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
! Doctor found issues in 2 categories.
EDIT
after further testing trying to find the problem.. i discovered the conflicting plugin was flutter_geofire: ^1.0.3 when ever the both of them are on the app the servicewil start but the taskwill not.
I created a new project and integrated this plugin and it worked fine . But i inserted it into an existing project with some plugins which include firebase plugins....When ever i try to run periodicTaskFun i get the error below:
will be glad if i could get help.
EDIT
after further testing trying to find the problem.. i discovered the conflicting plugin was
flutter_geofire: ^1.0.3
when ever the both of them are on the app theservice
wil start but thetask
will not.