Since upgrading my Nexus 5X to Android N, I have the following crash when using EditText:
java.lang.UnsupportedOperationException: Failed to resolve attri
Add this to your Edit text view android:textAppearance="@color/" like this:
<EditText
android:textAppearance="@color/abc_primary_text_disable_only_material_dark"
...
/>
"@color/abc_primary_text_disable_only_material_dark" (built in) :
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/bright_foreground_disabled_material_dark"/>
<item android:color="@color/bright_foreground_material_dark"/>
</selector>
it works for me
In the stack trace there was a reference to SuggestionsPopupWindow that made me think of disabling suggestions for EditText.
I used the following code as a workaround:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
if ((editText.getInputType() & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) != InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS) {
editText.setInputType(editText.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
}
}
We can also set inputType in XML, but the above code allows us to add TYPE_TEXT_FLAG_NO_SUGGESTIONS to existent input type.
Updating the support library to 25.0.0 or higher fixes this issue