braintree / braintree_android

Braintree SDK for Android
https://developer.paypal.com/braintree/docs/start/hello-client/android/v4
MIT License
409 stars 237 forks source link

Intermittent NullPointerException When Paying with Google Pay Using SDK Version 5.1.0 #1196

Closed stwonary closed 4 weeks ago

stwonary commented 1 month ago

Braintree SDK Version

5.1.0

Environment

Production

Android Version & Device

samsung a32x

Braintree dependencies

def braintree_version = '5.1.0'

implementation "com.braintreepayments.api:card:$braintree_version"
implementation "com.braintreepayments.api:data-collector:$braintree_version"
implementation "com.braintreepayments.api:three-d-secure:$braintree_version"

implementation "com.braintreepayments.api:american-express:$braintree_version"
implementation "com.braintreepayments.api:google-pay:$braintree_version"
implementation "com.braintreepayments.api:paypal:$braintree_version"

Describe the bug

When users attempt to pay using Google Pay, the application intermittently crashes with a NullPointerException. This issue has been reported by some users in production, but I have been unable to reproduce the crash on my own device.

To reproduce

1.  Initiate a payment process in the app.
2.  Select Google Pay as the payment method.
3.  Attempt to complete the payment.

Expected behavior

The payment should process successfully without causing the app to crash.

Screenshots

No response

stwonary commented 1 month ago

Stacktrace:

Exception java.lang.RuntimeException:
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3716)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3853)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:101)
  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:2345)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:209)
  at android.os.Looper.loop (Looper.java:296)
  at android.app.ActivityThread.main (ActivityThread.java:7941)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:569)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1019)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Class.isInterface()' on a null object reference
  at java.lang.Class.isAssignableFrom (Class.java:890)
  at android.os.Parcel.readParcelableCreatorInternal (Parcel.java:4853)
  at android.os.Parcel.readParcelableInternal (Parcel.java:4766)
  at android.os.Parcel.readValue (Parcel.java:4532)
  at android.os.Parcel.readValue (Parcel.java:4312)
  at android.os.Parcel.-$$Nest$mreadValue
  at android.os.Parcel$LazyValue.apply (Parcel.java:4410)
  at android.os.Parcel$LazyValue.apply (Parcel.java:4369)
  at android.os.BaseBundle.getValueAt (BaseBundle.java:394)
  at android.os.BaseBundle.getValue (BaseBundle.java:374)
  at android.os.BaseBundle.getValue (BaseBundle.java:357)
  at android.os.BaseBundle.get (BaseBundle.java:696)
  at android.os.Bundle.getParcelable (Bundle.java:947)
  at android.content.Intent.getParcelableExtra (Intent.java:8902)
  at com.braintreepayments.api.googlepay.GooglePayActivity.onCreate (GooglePayActivity.kt)
  at android.app.Activity.performCreate (Activity.java:8290)
  at android.app.Activity.performCreate (Activity.java:8269)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1384)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3697)
saperi22 commented 1 month ago

@stwonary thanks for reporting this issue. It looks like there is an issue with one of the APIs we are using on Tiramisu (API 33). See google issue.

Would you be able to confirm if this only happens on API 33? It would also help if you are able to provide how many users are affected/ how often.

Please track progress https://github.com/braintree/braintree_android/pull/1197.

stwonary commented 1 month ago

Thank you for looking into this issue. Yes, I can confirm that the crash is only happening on API 33. We were in the process of rolling out a progressive update with the updated SDK but had to halt it due to this crash. Since the release, we have received 27 crash reports, all from devices running API 33.

saperi22 commented 1 month ago

I'll let you know when we are able to make another release.

stwonary commented 1 month ago

Hi @saperi22

I noticed that your PR has been merged. Do you have an estimated release date for the fix? Or would you recommend downgrading to version 5.0.0 in the meantime? Our release is currently on hold due to this issue.

Thanks!

saperi22 commented 4 weeks ago

@stwonary we will mostly cut a new release by end of the day today.

stwonary commented 4 weeks ago

Great, thanks for the update!

saperi22 commented 4 weeks ago

@stwonary 5.2.0 was just released.

stwonary commented 4 weeks ago

Thank you very much. I’ll reopen the ticket if the issue persists.