stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.29k stars 645 forks source link

CardInputWidget cant be inflated #3770

Closed ChadiGSfeir closed 3 years ago

ChadiGSfeir commented 3 years ago

Summary

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.dev, PID: 10077 android.view.InflateException: Binary XML file line #57: Binary XML file line #57: Error inflating class com.stripe.android.view.CardInputWidget Caused by: android.view.InflateException: Binary XML file line #57: Error inflating class com.stripe.android.view.CardInputWidget Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:419) at android.app.Dialog.setContentView(Dialog.java:528) at com.example.dev.subscriptions.StartSubscriptionActivity.showAddPaymentDialog(StartSubscriptionActivity.java:313) at com.example.dev.subscriptions.StartSubscriptionActivity.lambda$onCreate$1$StartSubscriptionActivity(StartSubscriptionActivity.java:205) at com.example.dev.subscriptions.-$$Lambda$StartSubscriptionActivity$7YpX_mA5exg9JAJKWKcsekz_v7w.onClick(Unknown Source:2) at android.view.View.performClick(View.java:6294) at android.view.View$PerformClick.run(View.java:24770) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Code to reproduce

xml code: payment_dialog.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="20dp" tools:context=".subscriptions.StartSubscriptionActivity">

        <!--  ...  -->

        <com.stripe.android.view.CardInputWidget
            android:id="@+id/cardInputWidget"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <Button
            android:text="buy"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/payButton"
            android:layout_marginTop="20dp"
            android:backgroundTint="@android:color/holo_green_light"/>

        <!--  ...  -->

    </LinearLayout>

java code: StartSubscriptionActivity.java (calling the dialogue from on click button)

private void showAddPaymentDialog() { final Dialog dialog = new Dialog(StartSubscriptionActivity.this); dialog.setContentView(R.layout.dialog_payment); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.setCancelable(true); dialog.show(); }

Android version

8 , 9 , 10

Impacted devices

Testing on samsung, oppo, huawei, lge nexus 5x

Installation method

android grandle

SDK version

implementation 'com.stripe:stripe-android:16.9.0'

Other information

please help.

michelleb-stripe commented 3 years ago

I am sorry to hear you are having problems, and I am happy to help. Can you provide the details of the error you are seeing?

ChadiGSfeir commented 3 years ago

Hello yes, sure. I can't even see the com.stripe.android.view.CardInputWidget in the pre loaded design xml
Error: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.slyguard.dev, PID: 17366 android.view.InflateException: Binary XML file line #55: Binary XML file line #55: Error inflating class com.stripe.android.view.CardInputWidget Caused by: android.view.InflateException: Binary XML file line #55: Error inflating class com.stripe.android.view.CardInputWidget Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.rInflate(LayoutInflater.java:866) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:419) at android.app.Dialog.setContentView(Dialog.java:528) at com.example.dev.subscriptions.CurrentSubscriptionFragment.showAddPaymentDialog(CurrentSubscriptionFragment.java:283) at com.example.dev.subscriptions.CurrentSubscriptionFragment.lambda$onCreateView$7$CurrentSubscriptionFragment(CurrentSubscriptionFragment.java:264) at com.example.dev.subscriptions.-$$Lambda$CurrentSubscriptionFragment$Y7j1ha95gtQlg-ZeQtxOHbDtWQ0.onClick(Unknown Source:2) at android.view.View.performClick(View.java:6294) at android.view.View$PerformClick.run(View.java:24770) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

michelleb-stripe commented 3 years ago

Did you encounter this problem as part of upgrading from a prior version of the Stripe Android SDK, or is this a new integration?

I also have found varying versions between the Application and SDK to be problematic in the past. Would it be possible to match the following dependencies to what we use in our 16.9.0 SDK:

ChadiGSfeir commented 3 years ago

yes, the problem I think that when I update my dependencies. because everything was working fine and I didn't even change anything concerning the XML or the CardInputWidget. my dependencies are:

michelleb-stripe commented 3 years ago

What was the last version of the SDK that worked for you?

ChadiGSfeir commented 3 years ago

Im not sure :/ maybe 1.4.20 or 1.4.32 How can I downgrade the version? I'm trying from settings but I'm only allowed to have the latest.

michelleb-stripe commented 3 years ago

For setting the kotlin version there are a couple of places to set it: buildscript { ext.kotlinVersion = '1.4.32’.

repositories {
   …
}

dependencies {
    classpath 'com.android.tools.build:gradle:4.2.1'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    …
}

}

dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" }

michelleb-stripe commented 3 years ago

Did a prior version of the Android Stripe SDK work for you?

ChadiGSfeir commented 3 years ago

Yes, everything was working fine.

michelleb-stripe commented 3 years ago

Which prior version of the Android Stripe SDK was working? I can take a look and compare them to see if anything stands out as an issue.

Were you able to get setup with kotlin version 1.4.32?

ChadiGSfeir commented 3 years ago

yes, I did what you requested for the downgrade java version.

I will rebuild my project step by step and hope to figure out what causes the issue.

Note: I create a new project that I only add a stripe card Input widget. I updated everything even using the java 1.5.10, 'com.google.android.material:material:1.4.0-beta01', android version 4.2.1 and Grandle v 7.0.2 the cardinputwidget is working fine !!!

michelleb-stripe commented 3 years ago

ok, let us know if we can help.

ChadiGSfeir commented 3 years ago

in my xml I got this error: The following classes could not be instantiated: - com.stripe.android.view.CardInputWidget (Open Class, Show Exception, Clear Cache) - com.stripe.android.view.CardNumberEditText (Open Class, Show Exception, Clear Cache) - com.stripe.android.view.CvcEditText (Open Class, Show Exception, Clear Cache) - com.stripe.android.view.ExpiryDateEditText (Open Class, Show Exception, Clear Cache) - com.stripe.android.view.PostalCodeEditText (Open Class, Show Exception, Clear Cache)

java.lang.ClassCastException: class android.widget.EditText cannot be cast to class com.stripe.android.view.CardNumberEditText (android.widget.EditText is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @4b55f519; com.stripe.android.view.CardNumberEditText is in unnamed module of loader org.jetbrains.android.uipreview.ModuleClassLoader @10f2a91c) at com.stripe.android.databinding.CardInputWidgetBinding.bind(CardInputWidgetBinding.java:105) at com.stripe.android.databinding.CardInputWidgetBinding.inflate(CardInputWidgetBinding.java:89) at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:63) at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt:57) at com.stripe.android.view.CardInputWidget.(CardInputWidget.kt) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:399) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:189) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:147) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:303) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1121) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1124) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:1124) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1095) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082) at android.view.LayoutInflater.inflate(LayoutInflater.java:680) at android.view.LayoutInflater.inflate(LayoutInflater.java:499) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:354) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:431) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:141) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:710) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$6(RenderTask.java:865) at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$2.run(RenderExecutor.kt:174) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)

ChadiGSfeir commented 3 years ago

Hello, again I find that the last working version is implementation 'com.stripe:stripe-android:16.4.3'

this is my dependencies: dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.3.0' implementation 'com.android.support.constraint:constraint-layout:2.0.4' implementation 'androidx.cardview:cardview:1.0.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test:runner:1.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.2'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.google.code.gson:gson:2.8.7'

//dagger
implementation 'com.google.dagger:dagger-android:2.36'
implementation 'com.google.dagger:dagger-android-support:2.36'
annotationProcessor 'com.google.dagger:dagger-compiler:2.36'

// if you use the support libraries
annotationProcessor 'com.google.dagger:dagger-android-processor:2.36'
compileOnly 'org.glassfish:javax.annotation:10.0-b28'

//stripe
implementation 'com.stripe:stripe-android:16.4.3'
implementation 'com.aurelhubert:ahbottomnavigation:2.2.0'
implementation 'com.jaredrummler:android-processes:1.1.1'

//design/recyclerview/card view
implementation 'com.android.support:design:30.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.android.support:recyclerview-v7:30.0.0'
//implementation 'com.android.support:cardview-v7:30.0.0'

//room
def room_version = "2.4.0-alpha02"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"

// optional - RxJava support for Room
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.21'

//code annotation
implementation 'org.jetbrains:annotations:21.0.1'

//ted permission
implementation 'gun0912.ted:tedpermission:2.2.3'

//indicators (used in tutorial)
implementation 'me.relex:circleindicator:2.1.6'

//facebook
implementation 'com.facebook.android:facebook-android-sdk:9.1.1'

//google play service for authentication
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.android.gms:play-services-basement:17.6.0'

//google firebase
implementation 'com.google.firebase:firebase-core:19.0.0'
implementation 'com.google.firebase:firebase-messaging:22.0.0'

//google analytics
implementation 'com.google.firebase:firebase-analytics:19.0.0'
implementation 'com.google.firebase:firebase-crashlytics:18.0.0'

//google in-app messaging
implementation 'com.google.firebase:firebase-inappmessaging-display:20.0.0'
implementation 'com.google.android.play:core:1.10.0'

//google instant app
implementation 'com.google.android.gms:play-services-instantapps:17.0.0'
implementation 'com.google.firebase:firebase-dynamic-links:20.0.0'

//lottie animation
implementation 'com.airbnb.android:lottie:3.7.0'

//custom progress bar
implementation 'com.agrawalsuneet.androidlibs:dotsloader:1.4'

//google pay
implementation 'com.google.android.gms:play-services-wallet:18.1.3'

}

sz32 commented 3 years ago

Yes I'm also facing the same issue

using this dependecy implementation 'com.stripe:stripe-android:16.8.0' and also tried with latest 16.9.0, 16.10.0

2021-06-08 22:54:35.626 18617-18617/com.money.hub.loan E/AndroidRuntime: FATAL EXCEPTION: main Process: com.money.hub.loan, PID: 18617 android.view.InflateException: Binary XML file line #73 in com.money.hub.loan:layout/fragment_paymentsheet_add_card: Binary XML file line #73 in com.money.hub.loan:layout/fragment_paymentsheet_add_card: Error inflating class com.stripe.android.view.CardMultilineWidget Caused by: android.view.InflateException: Binary XML file line #73 in com.money.hub.loan:layout/fragment_paymentsheet_add_card: Error inflating class com.stripe.android.view.CardMultilineWidget Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:857) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1012) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:967) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1129) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1090) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1132) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1090) at android.view.LayoutInflater.inflate(LayoutInflater.java:680) at android.view.LayoutInflater.inflate(LayoutInflater.java:532) at com.stripe.android.paymentsheet.BaseAddCardFragment.onCreateView(BaseAddCardFragment.kt:81) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7660) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: android.view.InflateException: Binary XML file line #15 in com.money.hub.loan:layout/card_multiline_widget: Binary XML file line #15 in com.money.hub.loan:layout/card_multiline_widget: Error inflating class com.stripe.android.view.CardNumberEditText Caused by: android.view.InflateException: Binary XML file line #15 in com.money.hub.loan:layout/card_multiline_widget: Error inflating class com.stripe.android.view.CardNumberEditText Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:857) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1012) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:967) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1129) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1090) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1132) at android.view.LayoutInflater.inflate(LayoutInflater.java:654) at android.view.LayoutInflater.inflate(LayoutInflater.java:532) at android.view.LayoutInflater.inflate(LayoutInflater.java:479) at com.stripe.android.databinding.CardMultilineWidgetBinding.inflate(CardMultilineWidgetBinding.java:82) at com.stripe.android.view.CardMultilineWidget.<init>(CardMultilineWidget.kt:53) at com.stripe.android.view.CardMultilineWidget.<init>(CardMultilineWidget.kt:47) 2021-06-08 22:54:35.649 18617-18617/com.money.hub.loan E/AndroidRuntime: at com.stripe.android.view.CardMultilineWidget.<init>(Unknown Source:13) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:857) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1012) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:967) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1129) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1090) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1132) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1090) at android.view.LayoutInflater.inflate(LayoutInflater.java:680) at android.view.LayoutInflater.inflate(LayoutInflater.java:532) at com.stripe.android.paymentsheet.BaseAddCardFragment.onCreateView(BaseAddCardFragment.kt:81) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7660) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null object reference at com.stripe.android.view.StripeEditText.addTextChangedListener(StripeEditText.kt:273) at androidx.emoji2.viewsintegration.EmojiEditTextHelper$HelperInternal19.<init>(EmojiEditTextHelper.java:267) at androidx.emoji2.viewsintegration.EmojiEditTextHelper.<init>(EmojiEditTextHelper.java:109) at androidx.appcompat.widget.AppCompatEmojiEditTextHelper.<init>(AppCompatEmojiEditTextHelper.java:51) at androidx.appcompat.widget.AppCompatEditText.<init>(AppCompatEditText.java:112) at com.google.android.material.textfield.TextInputEditText.<init>(TextInputEditText.java:64) at com.stripe.android.view.StripeEditText.<init>(StripeEditText.kt:32) at com.stripe.android.view.CardNumberEditText.<init>(CardNumberEditText.kt:46) at com.stripe.android.view.CardNumberEditText.<init>(CardNumberEditText.kt:67) at com.stripe.android.view.CardNumberEditText.<init>(CardNumberEditText.kt:53) at com.stripe.android.view.CardNumberEditText.<init>(CardNumberEditText.kt:49) at com.stripe.android.view.CardNumberEditText.<init>(Unknown Source:11) ... 41 more

sz32 commented 3 years ago

anyone able to fix this issue? @ChadiGSfeir ?

ChadiGSfeir commented 3 years ago

Hey @sz32 , I didn't fix the bug. what I did is go back to my original project and continue working from there. (in my original project I update stripe to the latest version with the 'com.stripe:stripe-android:16.10.0' and 'com.google.android.material:material:1.4.0-beta01' ) My notes: 1-this could be something with the drawable file some of the files can be messed up. 2-app theme or some theme can be also the problem. 3-changing implementation 'androidx.appcompat:appcompat:1.3.0' can be also a problem im using 'androidx.appcompat:appcompat:1.3.0-rc01'.

Hope this helps you.

mshafrir-stripe commented 3 years ago

Hey @sz32 , I didn't fix the bug. what I did is go back to my original project and continue working from there. (in my original project I update stripe to the latest version with the 'com.stripe:stripe-android:16.10.0' and 'com.google.android.material:material:1.4.0-beta01' ) My notes: 1-this could be something with the drawable file some of the files can be messed up. 2-app theme or some theme can be also the problem. 3-changing implementation 'androidx.appcompat:appcompat:1.3.0' can be also a problem im using 'androidx.appcompat:appcompat:1.3.0-rc01'.

Hope this helps you.

Thanks for sharing notes. Do you require androidx.appcompat:appcompat:1.3.0-rc01 instead of androidx.appcompat:appcompat:1.3.0?

ChadiGSfeir commented 3 years ago

Hello @mshafrir-stripe, in my case, it's only working with 1.3.0-rc01 if I upgrade to 1.3.0 or 1.4.0-alpha02 the cardinputswidget will disappear.

vishalkumarsinghvi commented 3 years ago

Thanks, @ChadiGSfeir I downgraded from 1.4.0-aplha02 to 1.3.0-rc01 and working fine But please fix this issue for 1.4.0-aplha02

mshafrir-stripe commented 3 years ago

@ChadiGSfeir material-components:1.4.0-rc1 [0] is now available. Can you verify if you can reproduce the crash on this version?

[0] https://github.com/material-components/material-components-android/releases/tag/1.4.0-rc01

ChadiGSfeir commented 3 years ago

material-components:1.4.0-rc1

Hello @msaffitz-stripe , For implementation 'com.google.android.material:material:1.4.0-rc01', its working. The issue is in : implementation 'androidx.appcompat:appcompat: latest version '(latest version: 1.4.0-aplha02) the working version is 1.3.0-rc01

mshafrir-stripe commented 3 years ago

@ChadiGSfeir thanks for filing, I can reproduce the crash.

michelleb-stripe commented 3 years ago

@ChadiGSfeir A new version has been released, 16.10.2, and it should resolve this issue.

rscherf commented 1 year ago

I'm seeing similar behavior using, although I've never had this actually working so nothing to revert to:

com.stripe:stripe-android:20.29.2 and androidx.appcompat:appcompat:1.5.1

I'm attempting to inflate the CardInputWidget and using AlertDialog.Builder.setView() or Dialog.setContentView(). In fact, even just placing the CardInputWidget on my main activity view, I am seeing a looping crash.

    <com.stripe.android.view.CardInputWidget
        android:id="@+id/cardInputWidget"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

Hundreds of lines similar to this:

2023-09-11 12:51:21.196 21946-21946 m.nudge.paymen          com.nudge.payment                    W    at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
                                                                                                      at com.stripe.android.databinding.StripeCardInputWidgetBinding.inflate(StripeCardInputWidgetBinding.java:89)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:-1)
                                                                                                      at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
                                                                                                      at com.stripe.android.databinding.StripeCardInputWidgetBinding.inflate(StripeCardInputWidgetBinding.java:89)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:-1)
                                                                                                      at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
                                                                                                      at com.stripe.android.databinding.StripeCardInputWidgetBinding.inflate(StripeCardInputWidgetBinding.java:89)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:-1)
                                                                                                      at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
                                                                                                      at com.stripe.android.databinding.StripeCardInputWidgetBinding.inflate(StripeCardInputWidgetBinding.java:89)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
2023-09-11 12:51:21.196 21946-21946 m.nudge.paymen          com.nudge.payment                    W    at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:-1)
                                                                                                      at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
                                                                                                      at com.stripe.android.databinding.StripeCardInputWidgetBinding.inflate(StripeCardInputWidgetBinding.java:89)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:-1)
                                                                                                      at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
                                                                                                      at com.stripe.android.databinding.StripeCardInputWidgetBinding.inflate(StripeCardInputWidgetBinding.java:89)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:-1)
                                                                                                      at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
                                                                                                      at com.stripe.android.databinding.StripeCardInputWidgetBinding.inflate(StripeCardInputWidgetBinding.java:89)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:63)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:57)
                                                                                                      at com.stripe.android.view.CardInputWidget.<init>(CardInputWidget.kt:-1)
                                                                                                      at java.lang.reflect.Constructor.newInstance0(Native method)
                                                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
                                                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:858)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
                                                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
                                                                                                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
                                                                                                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
                                                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
tillh-stripe commented 1 year ago

Hi @rscherf 👋 Thanks for commenting. Can you open a new issue in this repo and include some information about the device and API level that you’re experiencing this crash on? If possible, please provide a small sample app that allows us to reliably reproduce the issue.