java.lang.UnsupportedOperationException: Can't convert to color: type=0x2

Stack Overflow | Sergey | 2 months ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0

    Failed to inflate ColorStateList, leaving it to the framework

    Stack Overflow | 2 months ago | Sergey
    java.lang.UnsupportedOperationException: Can't convert to color: type=0x2
  2. 0

    rendering and Logcat errors

    GitHub | 3 months ago | Theocom
    java.lang.RuntimeException: Failed to resolve attribute at index 0
  3. 0

    GitHub comment 267#273713870

    GitHub | 2 months ago | acsway878787
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gms/org.microg.gms.ui.SelfCheckFragment$AsActivity}: android.view.InflateException: Binary XML file line #24: Error inflating class org.microg.tools.ui.SwitchBar
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Resources$NotFoundException on Android KitKat and lower

    Stack Overflow | 1 month ago | B. Hurray
    android.content.res.Resources$NotFoundException: Resource ID #0x7f020090
  6. 0
    samebug tip
    As of SDK 23, you have to call this method with ContextCompat.getColor(context, R.color.my_color) so it works with previous API as well. Also, you have to add the support V4 library to your dependencies: "compile 'com.android.support:support-v4:23.0.1'"
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.UnsupportedOperationException

    Can't convert to color: type=0x2

    at android.content.res.TypedArray.getColor()
  2. Android Platform
    TypedArray.getColor
    1. android.content.res.TypedArray.getColor(TypedArray.java:326)
    1 frame
  3. android.support.v7
    AppCompatResources.getColorStateList
    1. android.support.v7.content.res.AppCompatColorStateListInflater.inflate(AppCompatColorStateListInflater.java:114)
    2. android.support.v7.content.res.AppCompatColorStateListInflater.createFromXmlInner(AppCompatColorStateListInflater.java:88)
    3. android.support.v7.content.res.AppCompatColorStateListInflater.createFromXml(AppCompatColorStateListInflater.java:67)
    4. android.support.v7.content.res.AppCompatResources.inflateColorStateList(AppCompatResources.java:116)
    5. android.support.v7.content.res.AppCompatResources.getColorStateList(AppCompatResources.java:74)
    5 frames
  4. Android v7
    AppCompatTextView.setTextAppearance
    1. android.support.v7.widget.TintTypedArray.getColorStateList(TintTypedArray.java:136)
    2. android.support.v7.widget.AppCompatTextHelper.onSetTextAppearance(AppCompatTextHelper.java:157)
    3. android.support.v7.widget.AppCompatTextView.setTextAppearance(AppCompatTextView.java:148)
    3 frames
  5. Android Support v4
    TextViewCompat.setTextAppearance
    1. android.support.v4.widget.TextViewCompatGingerbread.setTextAppearance(TextViewCompatGingerbread.java:103)
    2. android.support.v4.widget.TextViewCompat$BaseTextViewCompatImpl.setTextAppearance(TextViewCompat.java:86)
    3. android.support.v4.widget.TextViewCompat.setTextAppearance(TextViewCompat.java:283)
    3 frames
  6. android.support.design
    TextInputLayout.setError
    1. android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:607)
    2. android.support.design.widget.TextInputLayout.setError(TextInputLayout.java:693)
    3. android.support.design.widget.TextInputLayout.setError(TextInputLayout.java:680)
    3 frames
  7. my.package.databinding
    ActivityProductEditBinding.executeBindings
    1. my.package.databinding.ActivityProductEditBinding.executeBindings(ActivityProductEditBinding.java:394)
    1 frame
  8. android.databinding
    ViewDataBinding.executePendingBindings
    1. android.databinding.ViewDataBinding.executePendingBindings(ViewDataBinding.java:355)
    1 frame
  9. my.package.activities
    ProductEditActivity$2.prepareToSave
    1. my.package.activities.ProductEditActivity$2.prepareToSave(ProductEditActivity.java:62)
    2. my.package.activities.ProductEditActivity$2.prepareToSave(ProductEditActivity.java:45)
    2 frames
  10. my.package.listeners
    SaveListener.onSave
    1. my.package.listeners.SaveListener.onSave(SaveListener.java:22)
    1 frame
  11. my.package.databinding
    ActivityProductEditBinding._internalCallbackOnClick
    1. my.package.databinding.ActivityProductEditBinding._internalCallbackOnClick(ActivityProductEditBinding.java:438)
    1 frame
  12. android.databinding.generated
    OnClickListener.onClick
    1. android.databinding.generated.callback.OnClickListener.onClick(OnClickListener.java:11)
    1 frame
  13. Android Platform
    ActivityThread.main
    1. android.view.View.performClick(View.java:4204)
    2. android.view.View$PerformClick.run(View.java:17355)
    3. android.os.Handler.handleCallback(Handler.java:725)
    4. android.os.Handler.dispatchMessage(Handler.java:92)
    5. android.os.Looper.loop(Looper.java:137)
    6. android.app.ActivityThread.main(ActivityThread.java:5041)
    6 frames
  14. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:511)
    2 frames
  15. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    2 frames
  16. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame