NullPointerException on TextInputLayout.passwordVi

2019-06-22 09:28发布

I got an error in Firebase crash reporting about Password toggle button on an app in release mode in some real devices. The problem is the stack trace error is all about android.support.design code like you will see in the following log taken from firebase console:

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
android.graphics.drawable.AnimatedVectorDrawable.isStarted (AnimatedVectorDrawable.java:427)
android.graphics.drawable.AnimatedVectorDrawable.start (AnimatedVectorDrawable.java:440)
android.graphics.drawable.AnimatedStateListDrawable$AnimatedVectorDrawableTransition.start (AnimatedStateListDrawable.java:339)
android.graphics.drawable.AnimatedStateListDrawable.selectTransition (AnimatedStateListDrawable.java:226)
android.graphics.drawable.AnimatedStateListDrawable.onStateChange (AnimatedStateListDrawable.java:145)
android.graphics.drawable.Drawable.setState (Drawable.java:599)
android.support.v4.graphics.drawable.DrawableWrapperGingerbread.setState (DrawableWrapperGingerbread.java:145)
android.support.v4.graphics.drawable.DrawableWrapperLollipop.setState (DrawableWrapperLollipop.java:95)
android.widget.ImageView.drawableStateChanged (ImageView.java:1115)
android.support.v7.widget.AppCompatImageButton.drawableStateChanged (AppCompatImageButton.java:149)
android.view.View.refreshDrawableState (View.java:16052)
android.support.design.widget.CheckableImageButton.setChecked (CheckableImageButton.java:75)
android.support.design.widget.TextInputLayout.passwordVisibilityToggleRequested (TextInputLayout.java:1293)
android.support.design.widget.TextInputLayout$4.onClick (TextInputLayout.java:1074)
android.view.View.performClick (View.java:4785)
android.view.View$PerformClick.run (View.java:19888)
android.os.Handler.handleCallback (Handler.java:739)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:135)
android.app.ActivityThread.main (ActivityThread.java:5276)
java.lang.reflect.Method.invoke (Method.java) java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:911)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:706)

I have been tracking some errors related to this widget before, I mean, I post this question related to password toggle visibility and I had found some question about this component:

Also I found some AOSP issues about it:

Now I'm getting this error that I guess is happening when the user just press the toggle button

It's happening in the following real devices:
devices reported by firebase crash
The XML about the TextInputLayout and TextInputEditText and its theme:

<android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/TextLabel"
        app:passwordToggleEnabled="true">

        <android.support.design.widget.TextInputEditText
            android:id="@+id/login_field_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/perfil_field_password"
            android:inputType="textPassword"
            android:maxLines="1"
            android:maxLength="100"
            android:imeOptions="actionDone"
            android:textColor="@color/colorAccent"
            android:textSize="18sp"
            android:paddingStart="15dp"
            android:paddingEnd="5dp"/>
    </android.support.design.widget.TextInputLayout>

<style name="TextLabel" parent="TextAppearance.AppCompat">
    <!--//hint color And Label Color in False State-->
    <item name="android:textColorHint">@color/colorAccent</item>
    <item name="android:textColorHighlight">@color/colorAccent</item>
    <item name="android:textColorLink">@color/colorAccent</item>
    <!--<item name="android:textSize">20sp</item>-->
    <!--//Label color in True State And Bar Color False And True State-->
    <item name="colorAccent">@color/colorPrimary</item>
    <item name="colorControlNormal">@color/colorAccent</item>
    <item name="colorControlActivated">@color/colorAccent</item>
</style>

Like I said at beginning, it's toggle button code from support library and it smells like a bug.

Questions

  • Is there some work around or what I'm doing wrong? (disabling that button is not an option)
  • How can I report this to AOSP if I don't have enough "steps" to reproduce it, I just have what Firebase crash console gave me.

0条回答
登录 后发表回答