-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shutting down VM #6
Comments
what is your flutter? paste the code sample when the exception occurs from what I see, it is happens when you try to start the service task but I need your code to understand why it happens |
@SayWut thank you for your reply. I don't know how it happened.I will directly copy your sample code to main.dart and report this problem.It may be related to a library I referenced. At present, I have made the following changes to the library code, and the problem no longer occurs: private void setupChannels(BinaryMessenger messenger, Context context)
{
if(messenger != null) {
FlutterForegroundServiceChannelHandler handler = new FlutterForegroundServiceChannelHandler(context);
methodChannel = new MethodChannel(messenger, FOREGROUND_CHANNEL_CHANNEL);
methodChannel.setMethodCallHandler(handler);
}
} flutter doctor:
|
@xxzj990 But if the |
can you copy your code to here? |
I too have this problem. I'm not entirely sure why Flutter is calling it like it was a V1 embedding plugin, but it does now I guess. |
When I call FlutterForegroundServicePlugin.startPeriodicTask,get the following error:
D/AndroidRuntime( 7848): Shutting down VM E/AndroidRuntime( 7848): FATAL EXCEPTION: main E/AndroidRuntime( 7848): Process: xxx, PID: 7848 E/AndroidRuntime( 7848): java.lang.RuntimeException: Unable to start service com.saywut.flutter_foreground_service_plugin.FlutterForegroundService@204d1b2 with Intent { act=START_FOREGROUND_TASK cmp=xxx/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( 7848): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3057) E/AndroidRuntime( 7848): at android.app.ActivityThread.access$2200(ActivityThread.java:165) E/AndroidRuntime( 7848): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1467) E/AndroidRuntime( 7848): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime( 7848): at android.os.Looper.loop(Looper.java:150) E/AndroidRuntime( 7848): at android.app.ActivityThread.main(ActivityThread.java:5546) E/AndroidRuntime( 7848): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 7848): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794) E/AndroidRuntime( 7848): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684) E/AndroidRuntime( 7848): 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( 7848): at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:119) E/AndroidRuntime( 7848): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundServicePlugin.setupChannels(FlutterForegroundServicePlugin.java:45) E/AndroidRuntime( 7848): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundServicePlugin.registerWith(FlutterForegroundServicePlugin.java:23) E/AndroidRuntime( 7848): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundService.createFlutterEngineAndBackgroundChannel(FlutterForegroundService.java:220) E/AndroidRuntime( 7848): at com.saywut.flutter_foreground_service_plugin.FlutterForegroundService.onStartCommand(FlutterForegroundService.java:95) E/AndroidRuntime( 7848): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3040) E/AndroidRuntime( 7848): ... 8 more I/Process ( 7848): Sending signal. PID: 7848 SIG: 9
The text was updated successfully, but these errors were encountered: