sms_autofill icon indicating copy to clipboard operation
sms_autofill copied to clipboard

java.lang.IllegalStateException: Reply already submitted

Open JohannesMilke opened this issue 4 years ago • 12 comments

If I run these lines of code then doing a navigation to another screen and go back again, I get some android related errors.

Code snippet:

final _autoFill = SmsAutoFill();
final completePhoneNumber = await _autoFill.hint;

This issue seems be similar to this issue described here: https://github.com/flutter/flutter/issues/29092 "java.lang.IllegalStateException: Reply already submitted" However I am not sure whats going on there.

Errors I receive:

D/AndroidRuntime(32542): Shutting down VM
E/AndroidRuntime(32542): FATAL EXCEPTION: main
E/AndroidRuntime(32542): Process: app.xxx, PID: 32542
E/AndroidRuntime(32542): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=11012, result=0, data=Intent {  }} to activity {app.xxx/app.xxx.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(32542): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5097)
E/AndroidRuntime(32542): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5138)
E/AndroidRuntime(32542): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
E/AndroidRuntime(32542): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(32542): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(32542): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
E/AndroidRuntime(32542): 	at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(32542): 	at android.os.Looper.loop(Looper.java:237)
E/AndroidRuntime(32542): 	at android.app.ActivityThread.main(ActivityThread.java:7811)
E/AndroidRuntime(32542): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(32542): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(32542): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
E/AndroidRuntime(32542): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(32542): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:139)
E/AndroidRuntime(32542): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:231)
E/AndroidRuntime(32542): 	at com.jaumard.smsautofill.SmsAutoFillPlugin$1.onActivityResult(SmsAutoFillPlugin.java:68)
E/AndroidRuntime(32542): 	at io.flutter.app.FlutterPluginRegistry.onActivityResult(FlutterPluginRegistry.java:204)
E/AndroidRuntime(32542): 	at io.flutter.app.FlutterActivityDelegate.onActivityResult(FlutterActivityDelegate.java:127)
E/AndroidRuntime(32542): 	at io.flutter.app.FlutterActivity.onActivityResult(FlutterActivity.java:139)
E/AndroidRuntime(32542): 	at android.app.Activity.dispatchActivityResult(Activity.java:8292)
E/AndroidRuntime(32542): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5090)
E/AndroidRuntime(32542): 	... 11 more
I/Process (32542): Sending signal. PID: 32542 SIG: 9

JohannesMilke avatar Feb 28 '20 20:02 JohannesMilke

Same here

ooasis avatar Mar 03 '20 04:03 ooasis

Same,

cedvdb avatar Feb 08 '21 13:02 cedvdb

From the issue you mention flutter/flutter#29092 it look like it happen only during development and it's cause by hot reload, meaning no issues on production. Ok it's annoying ^^ but not critical. Not sure what I can do about it so far but I'll search

jaumard avatar Mar 04 '21 13:03 jaumard

I was getting this same issue & it was coming on production too.

Steps to reproduce in production (in my case):

  • have a button on a screen that calls hint
  • double click the button fast, it would show the phone no dialog twice
  • just close the dialogs by clicking outside. We get the error.

Possible solution: avoid multiple dialogs somehow, maybe my avoiding multiple clicks on the button before getting the first result or something.

vkbaloda avatar Oct 27 '21 11:10 vkbaloda

This is happening in production also now it is critical ... on lower end devices if you tap twice on phone hint dialog it crashes @jaumard

anchliyatushar avatar Dec 20 '21 14:12 anchliyatushar

Hi there! Have any one fixed this issue its coming in production.

SujeetKr6 avatar Sep 28 '22 12:09 SujeetKr6

+1

mustafal avatar Jan 24 '23 14:01 mustafal

me same issue

Nithinjovee avatar Mar 25 '23 05:03 Nithinjovee

Please check https://github.com/jaumard/sms_autofill/pull/199

anirudhsharma392 avatar Jun 01 '23 09:06 anirudhsharma392

Hi @jaumard

Just like what you have done on Line # 17 to Line # 25 on dart code and Line # 85 to Line # 87 on android code, we also need to implement the same method on Line # 30 on dart code and Line # 99 on android code to resolve this crash issue.

Reference attachment https://stackoverflow.com/questions/65666404/java-lang-illegalstateexception-reply-already-submitted-when-trying-to-call

danishkhawaja98 avatar Jul 31 '23 13:07 danishkhawaja98

What is the update on this? We can see still see this issue in our crashlytics even after upgrading to the latest version 2.3.0

princebansal avatar Nov 20 '23 08:11 princebansal

we also facing same issue. Multiple crashes are reported on our Firebase Crashlytics. Any update or solution on this? please let us know if we have any solution.

flutter version -- 3.13.9 sms_autofill plugin version -- 2.3.0

mohanK22 avatar Jun 04 '24 10:06 mohanK22