Closed grepx closed 4 months ago
Hi @grepx 👋 Thanks for reporting this issue, and for the detailed description. I’m able to reproduce the crash.
I’ll look into a solution for BottomSheetDialog
. In the meantime, is it feasible for you to switch to a BottomSheetDialogFragment
? This one is a Fragment
and thus a LifecycleOwner
, which means that the crash won’t occur.
Even easier: We provide a pre-built bottom sheet called PaymentSheet
, where you wouldn’t have to build any UI yourself. The docs are here and I’d be more than happy to help with the migration. It does support lots of local payment methods across the world, but you can also limit it to just cards if you want.
I'd also love to see this fixed, as it is blocking me from implementing the co-badged-card requirements on the CardInputWidget
, as I need to move from 20.29.2
to > 20.37.4
:
On the older version, there is no crash, however on the newer version it crashes.
View dialogView = LayoutInflater.from(this).inflate(R.layout.pv_stripe_card_input_widget, null);
com.stripe.android.view.CardInputWidget cardInputWidget = dialogView.findViewById(R.id.cardInputWidget);
androidx.appcompat.app.AlertDialog cardInputDialog = new MaterialAlertDialogBuilder(this, R.style.PaymentAlertDialogStyle)
.setView(dialogView)
.create();
cardInputDialog.show();
I'm going to close this as a duplicate of https://github.com/stripe/stripe-android/issues/8625
I realize this isn't fixed yet, and I apologize for that. We will work on a path forward and update the other issue when we have something to share.
Summary
Hi, I'm having a problem with
com.stripe.android.view.CardInputWidget
- it crashes when inflated inside BottomSheetDialog from SDK version20.32.0
- version20.31.0
is fine. The issue is still present in the latest SDK version20.36.0
. Compiles fine and crash happens at runtime on Android 14 (haven't tested other Android versions). I've tested using theCardInputWidget
inside the Fragment that launches the BottomSheetDialog and that seems to work fine - so it does seem like this has something particular to do with BottomSheetDialog.Code to reproduce
View creation happens via inflation inside an xml file:
Which is then inflated inside a
com.google.android.material.bottomsheet.BottomSheetDialog
using a view binding:Android version
Android 14
Impacted devices
Haven't tested other devices - happens on Pixel 7.
Installation method
Via gradle dependency.
Dependency Versions
kotlin: 1.9.10 stripe-android: 20.32.0 Android Gradle Plugin: 8.1.4 Gradle: 8.0
SDK classes
com.stripe.android.view.CardInputWidget
Video
Other information
This issue looks similar to the one described in https://github.com/stripe/stripe-android/issues/7484 and started occurring in the same release. It has not been fixed in the latest version (20.36.0) of the SDK though.
Stack Trace only contains Android SDK classes: