Skip to content
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

[BUG] IllegalStateException: Reply already submitted when calling HomeWidget.saveWidgetData on Android #265

Open
burhanaksendir opened this issue Jun 16, 2024 · 0 comments
Labels
p:Android Android Home Screen Widgets

Comments

@burhanaksendir
Copy link

Description

When calling HomeWidget.saveWidgetData on Android, the following error occurs:

E/MethodChannel#home_widget(10890): Failed to handle method call
E/MethodChannel#home_widget(10890): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#home_widget(10890): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431)
E/MethodChannel#home_widget(10890): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:272)
E/MethodChannel#home_widget(10890): at es.antonborri.home_widget.HomeWidgetPlugin.onMethodCall(HomeWidgetPlugin.kt:61)
E/MethodChannel#home_widget(10890): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#home_widget(10890): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#home_widget(10890): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#home_widget(10890): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#home_widget(10890): at android.os.Handler.handleCallback(Handler.java:958)
E/MethodChannel#home_widget(10890): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#home_widget(10890): at android.os.Looper.loopOnce(Looper.java:205)
E/MethodChannel#home_widget(10890): at android.os.Looper.loop(Looper.java:294)
E/MethodChannel#home_widget(10890): at android.app.ActivityThread.main(ActivityThread.java:8177)
E/MethodChannel#home_widget(10890): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#home_widget(10890): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/MethodChannel#home_widget(10890): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
E/DartMessenger(10890): Uncaught exception in binary message listener
E/DartMessenger(10890): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(10890): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431)
E/DartMessenger(10890): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:287)
E/DartMessenger(10890): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/DartMessenger(10890): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/DartMessenger(10890): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/DartMessenger(10890): at android.os.Handler.handleCallback(Handler.java:958)
E/DartMessenger(10890): at android.os.Handler.dispatchMessage(Handler.java:99)
E/DartMessenger(10890): at android.os.Looper.loopOnce(Looper.java:205)
E/DartMessenger(10890): at android.os.Looper.loop(Looper.java:294)
E/DartMessenger(10890): at android.app.ActivityThread.main(ActivityThread.java:8177)
E/DartMessenger(10890): at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(10890): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
E/DartMessenger(10890): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Steps to Reproduce
Add the home_widget package version 0.6.0 to your Flutter project.
Call HomeWidget.saveWidgetData on an Android device.
Observe the logcat output.
Expected behavior
The method should complete without throwing an exception.

Additional context
This error appears to be related to the MethodChannel reply mechanism in the Flutter plugin. Ensuring that a reply is sent only once per method call should resolve this issue.

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale tr-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] VS Code (version 1.90.1)
[✓] Network resources

Thank you for your assistance in resolving this issue.

@ABausG ABausG added the p:Android Android Home Screen Widgets label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:Android Android Home Screen Widgets
Projects
None yet
Development

No branches or pull requests

2 participants