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

[pay_android] GooglePayHandler.onActivityResult - lateinit property loadPaymentDataResult has not been initialized #206

Open
aleksandr-kopenkov-idf opened this issue Jul 19, 2023 · 7 comments

Comments

@aleksandr-kopenkov-idf
Copy link

This crash affects some users of Redmi devices.
Users have different versions of Android (10 - 12).
pay version: 1.1.1

Caused by kotlin.UninitializedPropertyAccessException: lateinit property loadPaymentDataResult has not been initialized
       at io.flutter.plugins.pay_android.GooglePayHandler.handlePaymentSuccess(GooglePayHandler.kt:216)
       at io.flutter.plugins.pay_android.GooglePayHandler.onActivityResult(GooglePayHandler.kt:180)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:807)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:430)
       at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:811)
       at io.flutter.embedding.android.FlutterFragment.onActivityResult(FlutterFragment.java:964)
       at io.flutter.embedding.android.FlutterFragmentActivity.onActivityResult(FlutterFragmentActivity.java:566)
       at android.app.Activity.dispatchActivityResult(Activity.java:8381)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:5334)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:5380)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:54)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2247)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:201)
       at android.os.Looper.loop(Looper.java:288)
       at android.app.ActivityThread.main(ActivityThread.java:7886)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:568)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
@maxim-ivanchuk-idf
Copy link

Same problem!

@TaN4eLL0
Copy link

Hello, our users have the same problem.
Please, urgently deal with this!

@pandeykushal
Copy link

hi did you had an issue with the real device

@JlUgia
Copy link
Member

JlUgia commented Jul 31, 2023

Thank you for reporting.
This seems to be related with the application/activity being collected by the system and calling onActivityResult on top of an obsolete/inexistent instance. Does that sound like something that could be happening on those RedMi devices?

I've pushed an update to the pay_android package (to 1.0.11), and pay package (to 1.1.2), that removes the activity result listener when the activity is disconnected. If the hypothesis is accurate, this update should fix the issue.
Please update the thread with the result of your tests @pandeykushal @TaN4eLL0 @maxim-ivanchuk-idf @aleksandr-kopenkov-idf

@aleksandr-kopenkov-idf
Copy link
Author

@JlUgia
Thanks for the update

@JlUgia
Copy link
Member

JlUgia commented Aug 14, 2023

Closing this issue for now.
Feel free to re-open if the underlying problem is not resolved.

@JlUgia JlUgia closed this as completed Aug 14, 2023
@ekaterina-demeshko-idf
Copy link

Hello @JlUgia, we still have crushes after updating pay to 1.1.2

Devices Xiomi, Android 12:


Caused by java.lang.NullPointerException:
       at io.flutter.plugins.pay_android.GooglePayHandler.onActivityResult(GooglePayHandler.kt:186)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:813)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:432)
       at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:868)
       at io.flutter.embedding.android.FlutterFragment.onActivityResult(FlutterFragment.java:1251)
       at io.flutter.embedding.android.FlutterFragmentActivity.onActivityResult(FlutterFragmentActivity.java:691)
       at android.app.Activity.dispatchActivityResult(Activity.java:8564)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:5455)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4904)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4950)
       at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2291)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:210)
       at android.os.Looper.loop(Looper.java:299)
       at android.app.ActivityThread.main(ActivityThread.java:8309)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)

And for Samsung, Huawei (Android 13 and 10):

   Caused by java.lang.NullPointerException:
   at io.flutter.plugins.pay_android.GooglePayHandler.handlePaymentSuccess(GooglePayHandler.kt:216)
   at io.flutter.plugins.pay_android.GooglePayHandler.onActivityResult(GooglePayHandler.kt:180)
   at io.flutter.embedding.engine.FlutterEngineConnectionRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEngineConnectionRegistry.java:813)
   at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.onActivityResult(FlutterEngineConnectionRegistry.java:432)
   at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:868)
   at io.flutter.embedding.android.FlutterFragment.onActivityResult(FlutterFragment.java:1251)
   at io.flutter.embedding.android.FlutterFragmentActivity.onActivityResult(FlutterFragmentActivity.java:691)
   at android.app.Activity.dispatchActivityResult(Activity.java:8541)
   at android.app.ActivityThread.deliverResults(ActivityThread.java:5775)
   at android.app.ActivityThread.handleSendResult(ActivityThread.java:5823)
   at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
   at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
   at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2613)
   at android.os.Handler.dispatchMessage(Handler.java:110)
   at android.os.Looper.loop(Looper.java:219)
   at android.app.ActivityThread.main(ActivityThread.java:8668)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)

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

6 participants