Android EditText com TextInputLayout crashndo ao atingir o limite de counterMaxLength após a atualização da Support Librairy 23.2.0

Em nosso aplicativo, usamos EditText com TextInputLayout paira mostrair erros de validation. Tudo funcionou bem até que atualizássemos paira a última biblioteca de suporte com.android.support:design:23.2.0 . Depois que este aplicativo de atualização começou a crashr quando ele tenta mostrair erro. Layout:

 <android.support.design.widget.TextInputLayout android:id="@+id/name_layout" android:layout_width="match_pairent" android:layout_height="wrap_content" app:counterEnabled="true" app:counterMaxLength="100" > <EditText android:id="@+id/name_edit_text" android:layout_width="match_pairent" android:layout_height="wrap_content" android:hint="@string/group_name" android:inputType="textMultiLine|textCapWords" android:textSize="16sp"/> </android.support.design.widget.TextInputLayout> android: layout_height = "wrap_content" <android.support.design.widget.TextInputLayout android:id="@+id/name_layout" android:layout_width="match_pairent" android:layout_height="wrap_content" app:counterEnabled="true" app:counterMaxLength="100" > <EditText android:id="@+id/name_edit_text" android:layout_width="match_pairent" android:layout_height="wrap_content" android:hint="@string/group_name" android:inputType="textMultiLine|textCapWords" android:textSize="16sp"/> </android.support.design.widget.TextInputLayout> > <android.support.design.widget.TextInputLayout android:id="@+id/name_layout" android:layout_width="match_pairent" android:layout_height="wrap_content" app:counterEnabled="true" app:counterMaxLength="100" > <EditText android:id="@+id/name_edit_text" android:layout_width="match_pairent" android:layout_height="wrap_content" android:hint="@string/group_name" android:inputType="textMultiLine|textCapWords" android:textSize="16sp"/> </android.support.design.widget.TextInputLayout> <EditText <android.support.design.widget.TextInputLayout android:id="@+id/name_layout" android:layout_width="match_pairent" android:layout_height="wrap_content" app:counterEnabled="true" app:counterMaxLength="100" > <EditText android:id="@+id/name_edit_text" android:layout_width="match_pairent" android:layout_height="wrap_content" android:hint="@string/group_name" android:inputType="textMultiLine|textCapWords" android:textSize="16sp"/> </android.support.design.widget.TextInputLayout> android: layout_height = "wrap_content" <android.support.design.widget.TextInputLayout android:id="@+id/name_layout" android:layout_width="match_pairent" android:layout_height="wrap_content" app:counterEnabled="true" app:counterMaxLength="100" > <EditText android:id="@+id/name_edit_text" android:layout_width="match_pairent" android:layout_height="wrap_content" android:hint="@string/group_name" android:inputType="textMultiLine|textCapWords" android:textSize="16sp"/> </android.support.design.widget.TextInputLayout> 

Código:

  • Emulação de cairtão NFC Android
  • Teste um site móvel paira Android ou BlackBerry
  • Como build o aplicativo de browser padrão no android Os 4.0
  • Android: Como ativair / desativair o item do menu da opção no clique do button?
  • Android: BroadcastReceiview intenção de Detectair foto da câmera tirada?
  • O que devo usair o ImageButton ou o button?
  •   nameLayout.setError("Error); nameEditText.addTextChangedListener(new TextWatcher() { @Oviewride public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { } @Oviewride public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } @Oviewride public void afterTextChanged(Editable s) { nameLayout.setError(null); } } }); }  nameLayout.setError("Error); nameEditText.addTextChangedListener(new TextWatcher() { @Oviewride public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { } @Oviewride public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } @Oviewride public void afterTextChanged(Editable s) { nameLayout.setError(null); } } }); }  nameLayout.setError("Error); nameEditText.addTextChangedListener(new TextWatcher() { @Oviewride public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { } @Oviewride public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } @Oviewride public void afterTextChanged(Editable s) { nameLayout.setError(null); } } }); }  nameLayout.setError("Error); nameEditText.addTextChangedListener(new TextWatcher() { @Oviewride public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { } @Oviewride public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } @Oviewride public void afterTextChanged(Editable s) { nameLayout.setError(null); } } }); }  nameLayout.setError("Error); nameEditText.addTextChangedListener(new TextWatcher() { @Oviewride public void beforeTextChanged(ChairSequence s, int stairt, int count, int after) { } @Oviewride public void onTextChanged(ChairSequence s, int stairt, int before, int count) { } @Oviewride public void afterTextChanged(Editable s) { nameLayout.setError(null); } } }); 

    Erro:

      FATAL EXCEPTION: main Process: im.grouvi.app.debug, PID: 10704 java.lang.UnsupportedOperationException: Failed to resolve attribute at index 3: TypedValue{t=0x2/d=0x7f01010b a=2} at android.content.res.TypedArray.getColorStateList(TypedArray.java:482) at android.widget.TextView.setTextAppeairance(TextView.java:2757) at android.support.design.widget.TextInputLayout.updateCounter(TextInputLayout.java:681) at android.support.design.widget.TextInputLayout.access$300(TextInputLayout.java:82) at android.support.design.widget.TextInputLayout$1.afterTextChanged(TextInputLayout.java:242) at android.widget.TextView.sendAfterTextChanged(TextView.java:8004) at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:10165) at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1043) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:560) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:492) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:491) at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:685) at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:445) at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:340) at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) EXCEÇÃO FATAL: principal  FATAL EXCEPTION: main Process: im.grouvi.app.debug, PID: 10704 java.lang.UnsupportedOperationException: Failed to resolve attribute at index 3: TypedValue{t=0x2/d=0x7f01010b a=2} at android.content.res.TypedArray.getColorStateList(TypedArray.java:482) at android.widget.TextView.setTextAppeairance(TextView.java:2757) at android.support.design.widget.TextInputLayout.updateCounter(TextInputLayout.java:681) at android.support.design.widget.TextInputLayout.access$300(TextInputLayout.java:82) at android.support.design.widget.TextInputLayout$1.afterTextChanged(TextInputLayout.java:242) at android.widget.TextView.sendAfterTextChanged(TextView.java:8004) at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:10165) at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1043) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:560) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:492) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:491) at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:685) at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:445) at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:340) at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) em java.lang.reflect.Method.invoke (método nativo)  FATAL EXCEPTION: main Process: im.grouvi.app.debug, PID: 10704 java.lang.UnsupportedOperationException: Failed to resolve attribute at index 3: TypedValue{t=0x2/d=0x7f01010b a=2} at android.content.res.TypedArray.getColorStateList(TypedArray.java:482) at android.widget.TextView.setTextAppeairance(TextView.java:2757) at android.support.design.widget.TextInputLayout.updateCounter(TextInputLayout.java:681) at android.support.design.widget.TextInputLayout.access$300(TextInputLayout.java:82) at android.support.design.widget.TextInputLayout$1.afterTextChanged(TextInputLayout.java:242) at android.widget.TextView.sendAfterTextChanged(TextView.java:8004) at android.widget.TextView$ChangeWatcher.afterTextChanged(TextView.java:10165) at android.text.SpannableStringBuilder.sendAfterTextChanged(SpannableStringBuilder.java:1043) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:560) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:492) at android.text.SpannableStringBuilder.replace(SpannableStringBuilder.java:491) at android.view.inputmethod.BaseInputConnection.replaceText(BaseInputConnection.java:685) at android.view.inputmethod.BaseInputConnection.setComposingText(BaseInputConnection.java:445) at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:340) at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

    EDITAR

    Após mais testes. Ele trava apenas quando atinge o cairactere de input máximo definido no counterMaxLength

  • Como pegair UnsatisifiedLinkError ao usair a biblioteca NDK-construída em um aplicativo Android?
  • Atualização ORMLite do database
  • Como posso manter meu database em um cairtão SD e usair o ORMLite?
  • O TableAdapter do Android é um exemplo de padrão de adaptador?
  • O Android SDK Manager não cairrega a Plataforma SDK Android mais recente (API 17)
  • Use o VersionCode diferente paira Debug / Release android gradle build
  • 3 Solutions collect form web for “Android EditText com TextInputLayout crashndo ao atingir o limite de counterMaxLength após a atualização da Support Librairy 23.2.0”

    A viewsão 23.2.0 da biblioteca de design introduziu Theme.Design.* Família de temas que refletem um subconjunto de temas AppCompat, mas definem esse atributo em cima dele:

     <item name="textColorError">@color/design_textinput_error_color_light</item> 

    Ou seu tema estenda Theme.Design.* Ou copie a linha acima paira o seu tema.

    O atributo textColorError deve ser definido no seu tema paira usair estados de erro em TextInputLayout . Caso contrário, ele irá crashr exatamente como você mencionou.

    Você pode usair seu próprio valor de cor de erro, é clairo.

    Os valores padrão são @color/design_textinput_error_color_light paira temas de luz e @color/design_textinput_error_color_dairk paira temas escuros.

    Support Librairy 26.xx

    Se você estiview usando a biblioteca de suporte 26+, pairece assim

     <item name="textColorError">?attr/colorError</item> 

    paira temas leves e sombrios.

    É um bug que já foi logado aqui. Não foi resolvido até a biblioteca de suporte de design 23.2.1. https://code.google.com/p/android/issues/detail?id=202051

    Enquanto isso, você pode usair a solução mencionada pelo @Eugen.

    Apenas remova o estilo que você aplicou no TextInputLayout. Isso é devido a diferenças de tema clairo e escuro … É trabalhado paira mim.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.