I am seeing this error in a live app thus I have no clue why this happening. All I have is this exception log (see below). At first, I thought I applied style editTextBackgroungWhite(see below)to the editText inside my XML but removing it has no effect on the problem.
I'll be glad if someone could guide me towards the right direction.
P.S I am not able to replicate this bug on my device seems that it's a problem with some Samsung note series device only.
<style name="editTextBackgWhite"parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">#ffffff</item>
<item name="colorControlActivated">#ffffff</item>
<item name="colorControlHighlight">#ffffff</item>
</style>
Fatal Exception: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}
at android.content.res.TypedArray.getColorStateList(TypedArray.java:484)
at android.text.style.TextAppearanceSpan.(TextAppearanceSpan.java)
at android.text.style.TextAppearanceSpan.(TextAppearanceSpan.java)
at android.widget.Editor$SuggestionsPopupWindow$SuggestionInfo.(Editor.java)
at android.widget.Editor$SuggestionsPopupWindow$SuggestionInfo.(Editor.java)
at android.widget.Editor$SuggestionsPopupWindow.initContentView(Editor.java:2995)
at android.widget.Editor$PinnedPopupWindow.(Editor.java)
at android.widget.Editor$SuggestionsPopupWindow.(Editor.java)
at android.widget.Editor.showSuggestions(Editor.java:2229)
at android.widget.Editor$2.run(Editor.java:2109)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
The main cause of this problem seems to be a missing style/theme in the AppCompat library, or a bug in the library. It happens when using either AppCompatEditText or AppCompatAutoCompleteTextView and a WebView is also added to the layout (AdMob ads are WebViews). It happens on several versions of AppCompat, like 23, 24, 25, 26.
It can be seen more clearly in a useful demo app that someone made on Github:
build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
...
}
app/build.gradle:
buildToolsVersion '25.0.0'
gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
The solution (from here) is to explicitly add both "colorAccent"
and "android:colorAccent"
in your main AppTheme, in styles.xml:
<style name="AppTheme" parent="Theme.AppCompat">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorAccent" tools:targetApi="lollipop">@color/colorAccent</item>
</style>
or
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorAccent" tools:targetApi="lollipop">@color/colorAccent</item>
</style>
This will now work to allow the stock spelling suggestions popup to appear, and no more crashing.
Similar reports or duplicates:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With