intent icon indicating copy to clipboard operation
intent copied to clipboard

Crash on second intent

Open besserwisser opened this issue 6 years ago • 5 comments

I am starting a camera with startActivityForResult. The first time I get the path to the taken image back as it should. When I use the intent again, the app crashes without any error in the flutter console. But I get some Logcat output (from Android Studio).

Here the code:

        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.camera_alt),
          onPressed: () => android_intent.Intent()
            ..setAction(android_action.Action.ACTION_IMAGE_CAPTURE)
            ..startActivityForResult()
            .then(
                  (data) {
                      print(data[0]);
                  },
              onError: (e) =>
                  print(e.toString()),
            )
        ),

And here the error message in Logcat:

020-02-06 11:39:12.549 21972-21972/com.example.vivo_mobile_testing_app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.vivo_mobile_testing_app, PID: 21972
    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=998, result=-1, data=null} to activity {com.example.vivo_mobile_testing_app/com.example.vivo_mobile_testing_app.MainActivity}: java.lang.IllegalStateException: Reply already submitted
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4506)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4548)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1916)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.IllegalStateException: Reply already submitted
        at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:148)
        at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:234)
        at io.github.itzmeanjan.intent.IntentPlugin$onMethodCall$5.sendDocument(IntentPlugin.kt:132)
        at io.github.itzmeanjan.intent.IntentPlugin$onMethodCall$1.onActivityResult(IntentPlugin.kt:68)
        at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEnginePluginRegistry.java:634)
        at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult(FlutterEnginePluginRegistry.java:367)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:546)
        at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:594)
        at android.app.Activity.dispatchActivityResult(Activity.java:7476)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4499)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4548) 
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1916) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6898) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 

The expected behaviour for me would have been that it works on the second time, too.

besserwisser avatar Feb 06 '20 10:02 besserwisser

Same problem with android_action.Action.ACTION_CALL. How to fix it?

fipooo avatar Jun 11 '20 22:06 fipooo

Same problem for me also.... any updates on this ?

baskar007 avatar Jul 30 '20 15:07 baskar007

same problem for me, If anyone found a solution Please reply

yati989 avatar Sep 08 '20 22:09 yati989

Same problem. Any updates?

sunilprajapatisa avatar Sep 16 '20 09:09 sunilprajapatisa

Facing the same challenge with intent

nzekakooza avatar Apr 01 '22 20:04 nzekakooza