-
Notifications
You must be signed in to change notification settings - Fork 79
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
Layout and Inflate Errors #418
Comments
Hi @sawyermade thanks for using the Braintree SDK for Android. I'm trying to reproduce this error but I'm having trouble on a Pixel 6 Pro and a Galaxy S21 5G. Using the same steps to reproduce, does this same crash occur on another device / emulator? |
No I haven't, I can try that though. Quick question though, why would the PayPal load just fine but the CC doesn't? Isn't that kind of strange? I did start a brand new app with only the drop in and it worked fine. The Gradle was setup the same as well. It's just strange that only CC does it? But yeah, I will check with other devices later, I wasn't sure if this was a known problem with a quick workaround, thanks for the response and I will get back to you once I try it on something else. |
@sawyermade awesome thanks! For the PayPal flow we use a Chrome custom tab, so there isn't as much View inflation happening in that flow. Our DropIn library depends on another library we maintain called android-card-form and We haven't seen any issues with android-card-form lately, but we'll keep an eye out. If you have additional information, feel free to reach out and we'll take a look. |
@sshropshire I'll have some different devices later this afternoon but in the meantime, here's the activity that calls the drop in (I removed all the misc buttons and text that don't matter) but is there anything you can see from the layout that would cause that error? I don't know the card form as well, it may be something stupid from the calling activity layout I overlooked. Thanks again and let me know if anything stands out I should add/remove and will let you know when I try on another device. The btnPaymentSave launches the drop in...
|
@sawyermade nothing stands out as out of place. Technically your layout shouldn't affect the presentation of DropIn since it's contained in its own |
@sshropshire So I tried on an LG with android v9 and still get the same identical error. Min api is v24 and target is v33. Could the min be a problem? Oh and I also tried to implement just card form and got the same error as well. |
@sshropshire Okay, did a little more digging and from the card form jar there's filename AddCardFragment.java with an error on line 50 it says "Cannot resolve symbol R": View view = inflater.inflate(R.layout.bt_fragment_add_card, container, false); That's kind of weird right, like what would cause it not to be able to resolve R (as it's used in basically every activity in our program)? Have you guys ever seen this error before? |
@sawyermade interesting I can't say that I have. We have an import statement in AddCardFragment.java that references the Out of curiosity if you repeat the steps to reproduce on an emulator, does it work as expected? |
@sshropshire I will test it out, but yeah that import was "R" method and it was red. In the import, only the R is red in android studio (Cannot resolve symbol R): import com.braintreepayments.api.dropin.R; Its really weird but yeah, I will try it on the emulator tmr and get back to you. Thanks for the help! |
@sshropshire Yeah, same thing. I also had my coworker run it off his windows PC (im on Mac and linux) with his v9 android and same stuff. Super weird the R isn't resolved, right? |
@sawyermade are y'all using proguard in your project? And to confirm it's the same behavior when using an emulator? |
@sshropshire We are using proguard, which version emulator should I try using? I believe I was using an older v9 android emulator I used before. Here is the proguard in the Gradle app section in the android {}:
|
Braintree SDK Version
6.9.0
Environment
Sandbox
Android Version & Device
Samsung S21 Ultra - Android 12
Braintree dependencies
implementation 'com.braintreepayments.api:drop-in:6.9.0'
Describe the bug
Once the drop in loads, the PayPal works fine and I can get the nonce but when clicking Credit or Debit Card it immediately crashes. This is the error I get:
FATAL EXCEPTION: main
Process: com.sjursolutions.videoinspectionprodev, PID: 8250
android.view.InflateException: Binary XML file line #32 in com.sjursolutions.videoinspectionprodev:layout/bt_fragment_add_card: Binary XML file line #32 in com.sjursolutions.videoinspectionprodev:layout/bt_fragment_add_card: Error inflating class com.braintreepayments.cardform.view.CardForm
Caused by: android.view.InflateException: Binary XML file line #32 in com.sjursolutions.videoinspectionprodev:layout/bt_fragment_add_card: Error inflating class com.braintreepayments.cardform.view.CardForm
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: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.rInflate(LayoutInflater.java:1130)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
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 com.braintreepayments.api.AddCardFragment.onCreateView(AddCardFragment.java:50)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2995)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:523)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:488)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8582)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:563)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)
Caused by: android.view.InflateException: Binary XML file line #9 in com.sjursolutions.videoinspectionprodev:layout/bt_card_form_fields: Binary XML file line #9: You must supply a layout_width attribute.
Caused by: java.lang.UnsupportedOperationException: Binary XML file line #9: You must supply a layout_width attribute.
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:831)
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:9230)
at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:9428)
at android.widget.LinearLayout$LayoutParams.(LinearLayout.java:2023)
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1917)
at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:89)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1129)
at android.view.LayoutInflater.inflate(LayoutInflater.java:660)
at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
at android.view.View.inflate(View.java:28455)
at com.braintreepayments.cardform.view.CardForm.init(CardForm.java:125)
at com.braintreepayments.cardform.view.CardForm.(CardForm.java:107)
at java.lang.reflect.Constructor.newInstance0(Native Method)
To reproduce
Tap Credit or Debit Card and it crashes
Expected behavior
Should load the credit or debit card form
Screenshots
No response
The text was updated successfully, but these errors were encountered: