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

Android Crash - PayPal RuntimeException: Failure delivering result ResultInfo #153

Open
alefl10 opened this issue Mar 7, 2024 · 6 comments

Comments

@alefl10
Copy link

alefl10 commented Mar 7, 2024

Attempting to use PayPal on Android crashes my Flutter App, and outputs the following console error

D/AndroidRuntime(12067): Shutting down VM
E/AndroidRuntime(12067): FATAL EXCEPTION: main
E/AndroidRuntime(12067): Process: com.ivisa.services.stg, PID: 12067
E/AndroidRuntime(12067): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1056, result=0, data=null} to activity {com.ivisa.services.stg/com.ivisa.services.MainActivity}: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(12067): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5323)
E/AndroidRuntime(12067): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:5362)
E/AndroidRuntime(12067): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
E/AndroidRuntime(12067): 	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
E/AndroidRuntime(12067): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(12067): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(12067): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
E/AndroidRuntime(12067): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(12067): 	at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(12067): 	at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(12067): 	at android.app.ActivityThread.main(ActivityThread.java:7872)
E/AndroidRuntime(12067): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(12067): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(12067): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E/AndroidRuntime(12067): Caused by: java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(12067): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431)
E/AndroidRuntime(12067): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:272)
E/AndroidRuntime(12067): 	at com.example.flutter_braintree.FlutterBraintreePlugin.onActivityResult(FlutterBraintreePlugin.java:134)
E/AndroidRuntime(12067): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:774)
E/AndroidRuntime(12067): 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:422)
E/AndroidRuntime(12067): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:857)
E/AndroidRuntime(12067): 	at io.flutter.embedding.android.FlutterFragment.onActivityResult(FlutterFragment.java:1251)
E/AndroidRuntime(12067): 	at io.flutter.embedding.android.FlutterFragmentActivity.onActivityResult(FlutterFragmentActivity.java:653)
E/AndroidRuntime(12067): 	at android.app.Activity.dispatchActivityResult(Activity.java:8628)
E/AndroidRuntime(12067): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:5316)
E/AndroidRuntime(12067): 	... 13 more
I/Process (12067): Sending signal. PID: 12067 SIG: 9

As far as I know, this problem usually arises in a plugin when the result of an onActivityResult call is propagated more than once or if the plugin's result handling code is triggered multiple times.

This is NOT affecting iOS.

@TuanMai777
Copy link

Hi @alefl10
Have you fixed this problem yet?

@alefl10
Copy link
Author

alefl10 commented Apr 29, 2024

@TuanMai777 no, the error still persists.

@pikaju are there any updates on it?

@nicolobozzato
Copy link
Contributor

Try to see if this solve your issue
#166

@alefl10
Copy link
Author

alefl10 commented Jul 15, 2024

Hey @nicolobozzato! Nope.. that didn't help. I still got the same issue which logged the same error details as included in the description and then crashed the app.

@alefl10
Copy link
Author

alefl10 commented Aug 19, 2024

@nicolobozzato @pikaju @claudius-kienle @TuanMai777

The issue must be coming from the methodChannel requestPaypalNonce, as that's what's been executed after calling Braintree.requestPaypalNonce.

/// Requests a PayPal payment method nonce.
///
/// [authorization] must be either a valid client token or a valid tokenization key.
/// [request] should contain all the information necessary for the PayPal request.
///
/// Returns a [Future] that resolves to a [BraintreePaymentMethodNonce] if the user confirmed the request,
/// or `null` if the user canceled the Vault or Checkout flow.
static Future<BraintreePaymentMethodNonce?> requestPaypalNonce(
  String authorization,
  BraintreePayPalRequest request,
) async {
  final result = await _kChannel.invokeMethod('requestPaypalNonce', {
    'authorization': authorization,
    'request': request.toJson(),
  });
  if (result == null) return null;
  return BraintreePaymentMethodNonce.fromJson(result);
}

@Adithyan2295
Copy link

Any update on the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants