Shawn
Shawn

Reputation: 31

Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}

I'm seeing the follow exception,

It only occurs when the Android SDK api level is 26, but it's ok in lower version.

Caused by: 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:538)
    at android.widget.TextView.<init>(TextView.java:904)
    at android.widget.TextView.<init>(TextView.java:818)
    at android.widget.TextView.<init>(TextView.java:814)

The xml file is

<TextView
        android:id="@+id/tv_app_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="@string/app_name"
        android:textColor="@color/black"
        android:textSize="@dimen/large" />

The Activity style is

<style name="HostCompatTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:elevation">0dp</item>
    <item name="android:buttonStyle">@style/NoShadowButton</item>
</style>

activity which uses this extends Activity, not ActionBarActivity. Any ideas why is it generating an error?

Upvotes: 3

Views: 8249

Answers (1)

Samir Bhatt
Samir Bhatt

Reputation: 3261

This is a bug and already reported to Google.

https://code.google.com/p/android/issues/detail?id=152141

Be sure you are using the correct theme.

Upvotes: 4

Related Questions