{"record":{"id":"089c3b75977da26f","repo":"JakeWharton/butterknife","slug":"required-tint-color-attribute-with-name-and-att","errorCode":null,"errorMessage":"Required tint color attribute with name {} and attribute ID {} was not found.","messagePattern":"Required tint color attribute with name (.+?) and attribute ID (.+?) was not found\\.","errorType":"exception","errorClass":"Resources.NotFoundException","httpStatus":null,"severity":"error","filePath":"butterknife-runtime/src/main/java/butterknife/internal/Utils.java","lineNumber":27,"sourceCode":"import androidx.annotation.DimenRes;\nimport androidx.annotation.DrawableRes;\nimport androidx.annotation.IdRes;\nimport androidx.annotation.UiThread;\nimport androidx.core.content.ContextCompat;\nimport androidx.core.graphics.drawable.DrawableCompat;\nimport java.util.Arrays;\nimport java.util.List;\n\n@SuppressWarnings(\"WeakerAccess\") // Used by generated code.\npublic final class Utils {\n  private static final TypedValue VALUE = new TypedValue();\n\n  @UiThread // Implicit synchronization for use of shared resource VALUE.\n  public static Drawable getTintedDrawable(Context context,\n      @DrawableRes int id, @AttrRes int tintAttrId) {\n    boolean attributeFound = context.getTheme().resolveAttribute(tintAttrId, VALUE, true);\n    if (!attributeFound) {\n      throw new Resources.NotFoundException(\"Required tint color attribute with name \"\n          + context.getResources().getResourceEntryName(tintAttrId)\n          + \" and attribute ID \"\n          + tintAttrId\n          + \" was not found.\");\n    }\n\n    Drawable drawable = ContextCompat.getDrawable(context, id);\n    drawable = DrawableCompat.wrap(drawable.mutate());\n    int color = ContextCompat.getColor(context, VALUE.resourceId);\n    DrawableCompat.setTint(drawable, color);\n    return drawable;\n  }\n\n  @UiThread // Implicit synchronization for use of shared resource VALUE.\n  public static float getFloat(Context context, @DimenRes int id) {\n    TypedValue value = VALUE;\n    context.getResources().getValue(id, value, true);\n    if (value.type == TypedValue.TYPE_FLOAT) {","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/JakeWharton/butterknife/blob/fcdebedf3276096db2f51bf6372b849b5a9c75ed/butterknife-runtime/src/main/java/butterknife/internal/Utils.java#L9-L45","documentation":"Thrown as Resources.NotFoundException by Utils.getTintedDrawable when the theme cannot resolve the tint attribute (@BindDrawable's tint field) referenced for a drawable binding. Before touching the drawable, ButterKnife resolves tintAttrId against the activity theme; failure means the attribute does not exist in the effective theme (or the ID itself is stale).","triggerScenarios":"Binding a field `@BindDrawable(value = R.drawable.icon, tint = R.attr.colorAccent) Drawable icon;` where R.attr.colorAccent is not defined/resolvable in the current Activity theme — e.g. a legacy theme missing the AppCompat attributes, or an attribute ID from another package not declared in the theme.","commonSituations":"Using @BindDrawable tint with an old framework theme (Theme without android: attributes, or a non-Material theme missing colorAccent); library modules referencing R.attr from a dependency not applied in the app's theme; resource-ID skew after a build change so tintAttrId points at a nonexistent entry. Because VALUE is a shared static TypedValue, this can also surface across theme swaps in tests.","solutions":["Set the activity theme to one that defines the attribute (e.g. Theme.AppCompat / Material descendant) in AndroidManifest or setContentView caller.","Use an attribute guaranteed present, e.g. android.R.attr.textColor or a project attr declared in your theme's <item>.","Drop the tint parameter and tint manually with DrawableCompat.setTint where theme control is uncertain."],"exampleFix":"// before\n@BindDrawable(value = R.drawable.badge, tint = R.attr.colorAccent) Drawable badge;\n<!-- theme = @android:style/Theme (no colorAccent) -->\n\n// after\n@BindDrawable(value = R.drawable.badge, tint = R.attr.colorAccent) Drawable badge;\n<!-- theme = @style/Theme.AppCompat.Light -->","handlingStrategy":"validation","validationCode":"TypedValue tv = new TypedValue();\nif (!getTheme().resolveAttribute(tintAttr, tv, true)) {\n  // fall back to untinted drawable or fail fast with context\n  throw new IllegalStateException(\"Theme lacks tint attr \" + tintAttr);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the activity theme (AppCompat/Material) defines the tint attribute you reference.","Prefer standard attrs (android.R.attr.*, colorAccent) known to exist in your theme.","Test @BindDrawable tint on the minimum API level and theme you ship."],"tags":["butterknife","resources","theme","tint","binddrawable","not-found"],"backgroundTag":null,"analyzedSha":"fcdebedf3276096db2f51bf6372b849b5a9c75ed","analyzedAt":"2026-08-14T10:13:55.083Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}