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
CardInputWidget cant be inflated #3770
Comments
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? |
Hello yes, sure. |
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:
|
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.
|
What was the last version of the SDK that worked for you? |
Im not sure :/ |
For setting the kotlin version there are a couple of places to set it:
} dependencies { |
Did a prior version of the Android Stripe SDK work for you? |
Yes, everything was working fine. |
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? |
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: |
ok, let us know if we can help. |
in my xml I got this error: 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) |
Hello, again this is my dependencies:
} |
Yes I'm also facing the same issue using this dependecy
|
anyone able to fix this issue? @ChadiGSfeir ? |
Hey @sz32 , I didn't fix the bug. Hope this helps you. |
Thanks for sharing notes. Do you require |
Hello @mshafrir-stripe, |
Thanks, @ChadiGSfeir |
@ChadiGSfeir [0] https://github.com/material-components/material-components-android/releases/tag/1.4.0-rc01 |
Hello @msaffitz-stripe , |
@ChadiGSfeir thanks for filing, I can reproduce the crash. |
In `androidx.appcompat:appcompat:1.4.0-alpha02`, `addTextChangedListener()` is called by a `StripeEditText` superclass. This was causing a crash because `textWatchers` was not instantiated before it was accessed. Change `textWatchers` to nullable and initialize it in `StripeEditText`'s `init` block. Fixes #3770
In `androidx.appcompat:appcompat:1.4.0-alpha02`, `addTextChangedListener()` is called by a `StripeEditText` superclass. This was causing a crash because `textWatchers` was not instantiated before it was accessed. Change `textWatchers` to nullable and initialize it in `StripeEditText`'s `init` block. Fixes #3770
In `androidx.appcompat:appcompat:1.4.0-alpha02`, `addTextChangedListener()` is called by a `StripeEditText` superclass. This was causing a crash because `textWatchers` was not instantiated before it was accessed. Change `textWatchers` to nullable and initialize it in `StripeEditText`'s `init` block. Fixes #3770
@ChadiGSfeir A new version has been released, 16.10.2, and it should resolve this issue. |
I'm seeing similar behavior using, although I've never had this actually working so nothing to revert to:
I'm attempting to inflate the <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:
|
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. |
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
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.
The text was updated successfully, but these errors were encountered: