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

com.stripe.android.view.CardMultilineWidget crashes when inflated inside Dialog #7799

Closed
erictamhk opened this issue Jan 22, 2024 · 1 comment
Labels

Comments

@erictamhk
Copy link

Summary

Hi, I'm having a problem with
com.stripe.android.view.CardMultilineWidget - it crashes when inflated inside Dialog from SDK version 20.35.0 - version 20.34.4 is fine. The issue is still present in the latest SDK version 20.36.1. Compiles fine and crash happens at runtime on Android 10 and 7

Code to reproduce

View creation happens via inflation inside an xml file:

            <com.stripe.android.view.CardMultilineWidget
                android:id="@+id/cardMultilineWidget"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                android:theme="@style/Stripe.CardMultilineWidget.TextInputLayout"
                app:shouldShowPostalCode="false" />

and the dialog code is

        binding = DialogPaymentMethodBinding.inflate(activity.getLayoutInflater());
        dialog = new Dialog(activity);
        dialog.setContentView(binding.getRoot());
        dialog.setCancelable(true);
        dialog.setCanceledOnTouchOutside(false);

Android version

Android 10

Installation method

Via gradle dependency.

Dependency Versions

kotlin: 1.9.0
stripe-android: 20.36.1
Android Gradle Plugin: 8.2.1
Gradle: 8.2

SDK classes

com.stripe.android.view.CardMultilineWidget

Video

Other information

FATAL EXCEPTION: main

java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from androidx.constraintlayout.widget.ConstraintLayout{e1a40b3 V.E...... ......I. 0,0-0,0}
	at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer(WindowRecomposer.android.kt:352)
	at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer$default(WindowRecomposer.android.kt:325)
	at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(WindowRecomposer.android.kt:168)
	at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.android.kt:224)
	at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(WindowRecomposer.android.kt:300)
	at androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext(ComposeView.android.kt:244)
	at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.android.kt:251)
	at androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow(ComposeView.android.kt:283)
	at android.view.View.dispatchAttachedToWindow(View.java:19635)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2103)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1791)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7867)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:967)
	at android.view.Choreographer.doCallbacks(Choreographer.java:791)
	at android.view.Choreographer.doFrame(Choreographer.java:726)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
	at android.os.Handler.handleCallback(Handler.java:883)
	at android.os.Handler.dispatchMessage(Handler.java:100)
	at android.os.Looper.loop(Looper.java:214)
	at android.app.ActivityThread.main(ActivityThread.java:7386)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)


@erictamhk erictamhk added the bug label Jan 22, 2024
@tillh-stripe
Copy link
Collaborator

Hj @erictamhk 👋 We received a similar report here.

I’ll close your issue, as it’s a duplicate, but feel free to follow along on the other issue. Please try the proposed workaround described there while we look into a proper fix.

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

2 participants