stripe-android: [BUG] Android 10 crash when trying to display the payment sheet

Summary

When launching a payment sheet, the app crashed, but only on Android 10. I cannot reproduce the problem on any other Android versions, but I can on many versions of our app so it does not seem to be tied to a specific version.

I did some tests and the problem did not occur when using the Test environment, only on Production. The only thing that worked was when I removed the GooglePayConfiguration when calling presentWithPaymentSheet.

So, just to recap, calling presentWithPaymentSheet with a GooglePayConfiguration crashed the app on an Android 10 device.

Stacktrace

image

Fatal Exception: java.lang.SecurityException: Unknown calling package name 'com.google.android.gms'.
       at android.os.Parcel.createException(Parcel.java:1950)
       at android.os.Parcel.readException(Parcel.java:1918)
       at android.os.Parcel.readException(Parcel.java:1868)
       at m.azi.q(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):172)
       at m.azf.a(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):14)
       at m.azh.c(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):7)
       at m.aza.d(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):7)
       at m.azb.handleMessage(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):281)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:193)
       at android.app.ActivityThread.main(ActivityThread.java:6718)

Android version

Android 10.0 Stripe version: Tested on both 20.32.0 and 20.35.1 with the same result

Impacted devices

Nothing specific, seen on Samsung, Google and Huawei devices

Installation method

Gradle

Dependency Versions

kotlin: 1.9.10 stripe-android: 20.35.1 Android Gradle Plugin: 8.0.0 Gradle: 8.0

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 5
  • Comments: 21

Most upvoted comments

If you are using Stripe’s Android SDK version >= v20.24.0 you can mitigate the issues by disabling Google Pay for users with an Android version <= 10:

if (android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.Q) {
  // Configure Stripe's SDK to not display a Google Pay button
}

For example:

val paymentSheetConfiguration = PaymentSheet.Configuration(
    merchantDisplayName = "Example, Inc.",
    googlePay = if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.Q) PaymentSheet.GooglePayConfiguration(
        environment = PaymentSheet.GooglePayConfiguration.Environment.Test,
        countryCode = "US",
        currencyCode = "USD"
    ) else null
)

A permanent fix for this issue will be rolled out to users by a Play Services update in January.

@VinuPolly-Bonnet no update. this is an issue on our (Google Pay) side. Affected users will receive a fix by a Play Services update in January.

Hi all. We started to rollout Play Services 24.02.12 to users. This version includes the fix. We expect rollout to hit 100% next week.

If you want to check your Google Play Services version go to: Settings -> Apps -> “See all X apps” -> Touch the search icon top right -> Search for Google Play Services -> scroll to the bottom of the page

We will see if we can do something to prevent this from crashing in the future.

@developermvuk on our side we deactivated the Google Pay option for Android 10 or less as soon as we got the crash frenzy. Waiting for a fix on Google side to reactivate it.

@tillh-stripe any way to have something done on your side to avoid a crash when this problem occurs? I know it’s a low frequency one, but still impacted a lot of our users.

Hey guys just checking if there has been an update on this recently ? The amount of crashes are a bit too much, before disabling Google Pay for users on Android versions 9 & 10 wanted to double check.

@jaynewstrom-stripe sorry to comment on this closed ticket, but I asked a question twice that was left unanswered 😦

I was just wondering if it could be investigated on your side to check if something could be done when such a problem occures? It had quite a big impact on our users with a lot of crashes so if we could just no show the Google Pay Button instead of crashing, that would be a big win in my opinion.

I’m going to close this as fixed. Please comment or reopen if you see this again.

@flo-Francis-Collins would you mind updating your first comment in this issue with a stacktrace?

Fatal Exception: java.lang.SecurityException: Unknown calling package name 'com.google.android.gms'.
       at android.os.Parcel.createException(Parcel.java:1950)
       at android.os.Parcel.readException(Parcel.java:1918)
       at android.os.Parcel.readException(Parcel.java:1868)
       at m.azi.q(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):172)
       at m.azf.a(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):14)
       at m.azh.c(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):7)
       at m.aza.d(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):7)
       at m.azb.handleMessage(:com.google.android.gms.dynamite_dynamitemodulesc@234816022@23.48.16 (100400-0):281)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:193)
       at android.app.ActivityThread.main(ActivityThread.java:6718)

This will make it much easier for people to find when looking for the cause of this issue.