woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
277 stars 135 forks source link

Crash when clicking on the help dialog button during login #3511

Closed anitaa1990 closed 3 years ago

anitaa1990 commented 3 years ago

When testing this PR, I found the following crash when clicking on the Find my Site address -> Need more Help? button when entering my site address during login.

2021-02-01 10:18:44.310 4206-4206/com.woocommerce.android.prealpha E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.woocommerce.android.prealpha, PID: 4206
    android.view.InflateException: Binary XML file line #20 in com.woocommerce.android.prealpha:layout/support_email_and_name_dialog: Binary XML file line #20 in com.woocommerce.android.prealpha:layout/support_email_and_name_dialog: Error inflating class com.woocommerce.android.widgets.WCMaterialOutlinedEditTextView
    Caused by: android.view.InflateException: Binary XML file line #20 in com.woocommerce.android.prealpha:layout/support_email_and_name_dialog: Error inflating class com.woocommerce.android.widgets.WCMaterialOutlinedEditTextView
    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:852)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
        at com.woocommerce.android.support.SupportHelperKt.supportIdentityInputDialogLayout(SupportHelper.kt:95)
        at com.woocommerce.android.support.SupportHelperKt.access$supportIdentityInputDialogLayout(SupportHelper.kt:1)
        at com.woocommerce.android.support.SupportHelper.showSupportIdentityInputDialog(SupportHelper.kt:36)
        at com.woocommerce.android.support.SupportHelper.showSupportIdentityInputDialog$default(SupportHelper.kt:32)
        at com.woocommerce.android.support.ZendeskHelper.requireIdentity(ZendeskHelper.kt:292)
        at com.woocommerce.android.support.ZendeskHelper.createNewTicket(ZendeskHelper.kt:156)
        at com.woocommerce.android.support.ZendeskHelper.createNewTicket$default(ZendeskHelper.kt:151)
        at com.woocommerce.android.ui.login.LoginActivity.helpFindingSiteAddress(LoginActivity.kt:445)
        at org.wordpress.android.login.LoginSiteAddressHelpDialogFragment$2.onClick(LoginSiteAddressHelpDialogFragment.java:68)
        at androidx.appcompat.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)
        at android.os.Handler.dispatchMessage(Handler.java:106)

This is not happening in the release version so I suspect it is due to the recent changes to Viewbinding in this PR.

anitaa1990 commented 3 years ago

cc @nbradbury would you be able to take a look at this one since it looks related to changes made to this PR during the Viewbinding changes. I am not able to reproduce this in the release version just the latest develop

hichamboushaba commented 3 years ago

This crash happens in all screens that use WCMaterialOutlinedSpinnerView and WCMaterialOutlinedEditTextView, as we try to access the not initialized yet binding in setEnabled when it's called from the base constructor.

I'll submit a fixing PR, as it's blocking me from fixing merge conflicts on shipping label PR.