Google Pay crash when using 4.10.0 in some cases
See original GitHub issueGeneral information
- SDK/Library version: 4.10.0
- Environment: Production
- Android Version and Device: Many devices, such as Galaxy A12 with Android 11
Issue description
When we are going to launch Google pay in version 4.10.0. It will crash sometimes.
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void androidx.activity.result.ActivityResultLauncher.launch(java.lang.Object)' on a null object reference
at com.braintreepayments.api.GooglePayLifecycleObserver.launch(GooglePayLifecycleObserver.java:44)
at com.braintreepayments.api.GooglePayClient$4$1.onResult(GooglePayClient.java:296)
at com.braintreepayments.api.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:41)
at com.braintreepayments.api.BraintreeClient$1.onAuthorizationResult(BraintreeClient.java:161)
at com.braintreepayments.api.AuthorizationLoader.loadAuthorization(AuthorizationLoader.java:20)
at com.braintreepayments.api.BraintreeClient.getAuthorization(BraintreeClient.java:170)
at com.braintreepayments.api.BraintreeClient.getConfiguration(BraintreeClient.java:157)
at com.braintreepayments.api.GooglePayClient$4.onAuthorizationResult(GooglePayClient.java:275)
at com.braintreepayments.api.AuthorizationLoader.loadAuthorization(AuthorizationLoader.java:20)
at com.braintreepayments.api.BraintreeClient.getAuthorization(BraintreeClient.java:170)
at com.braintreepayments.api.GooglePayClient.requestPayment(GooglePayClient.java:271)
at com.braintreepayments.api.GooglePayClient.requestPayment(GooglePayClient.java:228)
.....
Issue Analytics
- State:
- Created a year ago
- Comments:19 (9 by maintainers)
Top Results From Across the Web
react native - PaymentSheet Crashing on Android in v.0.19.0
On iOS everything works perfectly. To Reproduce I'm just following this Stripe Developers video about Accept a payment: export default function ...
Read more >Troubleshoot Chrome crashes - Google Support
Crashing issues with Chrome or a ChromeOS device can be caused a number of things. Here are some potential issues you might encounter:...
Read more >Brave should restore session gracefully after a crash #5512
In some cases, it doesn't properly save the session file (leaving them with an empty session). Expected behavior: When Brave is running: Session ......
Read more >Release Notes | Firebase - Google
This page provides a changelog that lists new SDK releases and describes updates to the Firebase console and Firebase services.
Read more >Bug listing with status RESOLVED with resolution UPSTREAM ...
... Bug:34744 - "OpenOffice freezes when rendering certain fonts with XFS" ... causes kernel oops" status:RESOLVED resolution:UPSTREAM severity:critical ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@contissi it may be specific to Google Pay here. The workaround could be removed if
tokenize
were called in response to a user action e.g. a “Google Pay” button press, only because the host activity will presumably be in aRESUMED
state.We use Jetpack Lifecycle internally to register for an activity result in
onCreate
. TheHandler
workaround is a bit of a hack to get the code to execute on the next run loop, which will be executed after all of the pending lifecycle methods i.e.onCreate
,onResume
etc. have completed synchronously.For now it is a good workaround. In the future, we should offer explicit support for
onCreate
tokenization by capturing a pendingGooglePayRequest
internally which will allow the SDK to defer launching the Google Pay flow until after Activity result registration is complete.I resolved this by:
onCreate