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

[BUG] PaymentSheet crash on java.lang.ClassCastException: android.graphics.drawable.VectorDrawable cannot be cast to android.graphics.drawable.GradientDrawable #7880

Open
starchey opened this issue Feb 5, 2024 · 2 comments
Labels

Comments

@starchey
Copy link

starchey commented Feb 5, 2024

Summary

We're seeing an occasional crash on Samsung devices when presenting the payment sheet with a payment intent.

FATAL EXCEPTION: main Process: com.ksl.android.classifieds, PID: 13363 java.lang.ClassCastException: android.graphics.drawable.VectorDrawable cannot be cast to android.graphics.drawable.GradientDrawable at m.axz.b(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (140400-0):12) at m.axm.a(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (140400-0):32) at com.google.android.gms.wallet.dynamite.PayButtonCreatorChimeraImpl.newPayButton(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (140400-0):143) at m.axd.z(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (140400-0):44) at m.ql.onTransact(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (140400-0):21) at android.os.Binder.transact(Binder.java:1219) at com.google.android.gms.internal.wallet.zza.zzb(com.google.android.gms:play-services-wallet@@19.3.0-beta01:2) at com.google.android.gms.wallet.button.zze.zzd(com.google.android.gms:play-services-wallet@@19.3.0-beta01:4) at com.google.android.gms.wallet.button.zzf.zza(com.google.android.gms:play-services-wallet@@19.3.0-beta01:6) at com.google.android.gms.wallet.button.PayButton.initialize(com.google.android.gms:play-services-wallet@@19.3.0-beta01:17) at com.stripe.android.paymentsheet.ui.GooglePayButtonKt$ComposePayButton$2$1.invoke(GooglePayButton.kt:95) at com.stripe.android.paymentsheet.ui.GooglePayButtonKt$ComposePayButton$2$1.invoke(GooglePayButton.kt:93) at androidx.compose.ui.viewinterop.ViewFactoryHolder$updateBlock$1.invoke(AndroidView.android.kt:367) at androidx.compose.ui.viewinterop.ViewFactoryHolder$updateBlock$1.invoke(AndroidView.android.kt:367) at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2299) at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:467) at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:230) at androidx.compose.ui.viewinterop.AndroidViewHolder$runUpdate$1.invoke(AndroidViewHolder.android.kt:178) at androidx.compose.ui.viewinterop.AndroidViewHolder$runUpdate$1.invoke(AndroidViewHolder.android.kt:176) at androidx.compose.ui.viewinterop.AndroidViewHolder.setUpdate(AndroidViewHolder.android.kt:110) at androidx.compose.ui.viewinterop.ViewFactoryHolder.setUpdateBlock(AndroidView.android.kt:367) at androidx.compose.ui.viewinterop.AndroidView_androidKt$AndroidView$3$1.invoke(AndroidView.android.kt:254) at androidx.compose.ui.viewinterop.AndroidView_androidKt$AndroidView$3$1.invoke(AndroidView.android.kt:254) at androidx.compose.runtime.ComposerImpl$apply$operation$1.invoke(Composer.kt:1712) at androidx.compose.runtime.ComposerImpl$apply$operation$1.invoke(Composer.kt:1710) at androidx.compose.runtime.ComposerImpl$recordInsert$2.invoke(Composer.kt:3546) at androidx.compose.runtime.ComposerImpl$recordInsert$2.invoke(Composer.kt:3543) at androidx.compose.runtime.CompositionImpl.applyChangesInLocked(Composition.kt:818) at androidx.compose.runtime.CompositionImpl.applyChanges(Composition.kt:849) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:625) at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$1.invoke(Recomposer.kt:537) at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:41) at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109) at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41) at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1648) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1659) at android.view.Choreographer.doCallbacks(Choreographer.java:1129)

Code to reproduce

Inside our fragment onCreate:

paymentSheet = PaymentSheet(this, ::onPaymentSheetResult)

Then, on the action to trigger the payment sheet:

paymentSheet.presentWithPaymentIntent(
    paymentIntentClientSecret,
    PaymentSheet.Configuration(
        merchantDisplayName = "Our App",
        googlePay = PaymentSheet.GooglePayConfiguration(
            environment = if (viewModel.uiState.value.isTestEnabled) {
                PaymentSheet.GooglePayConfiguration.Environment.Test
            } else {
                PaymentSheet.GooglePayConfiguration.Environment.Production
            },
            countryCode = "US",
            currencyCode = "USD"
        ),
        appearance = PaymentSheet.Appearance(
            colorsLight = PaymentSheet.Colors.defaultLight.copy(
                primary = resources.getColor(R.color.new_blue),
            ),
            typography = PaymentSheet.Typography.default.copy(
                fontResId = R.font.nunito_sans_ttf
            )
        )
    )
)

Android version

Android 14

Impacted devices

Samsung Galaxy S23

Installation method

Gradle

Dependency Versions

kotlin: 1.9.10
stripe-android: 20.37.1
Android Gradle Plugin: 8.2.2
Gradle: 8.3

SDK classes

PaymentSheet

@starchey starchey added the bug label Feb 5, 2024
@tillh-stripe
Copy link
Collaborator

@dmengelt This seems to be a Google Pay issue. Can you take a look?

@dmengelt
Copy link

dmengelt commented Feb 6, 2024

interesting. we aren't using android.graphics.drawable.VectorDrawable in our SDK.

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

No branches or pull requests

3 participants