{"record":{"id":"dcfab13745f68e61","repo":"JakeWharton/butterknife","slug":"more-than-one-bind-annotation-on","errorCode":null,"errorMessage":"More than one bind annotation on ","messagePattern":"More than one bind annotation on ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"butterknife-reflect/src/main/java/butterknife/ButterKnife.java","lineNumber":189,"sourceCode":"        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseBindDrawable(target, field, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseBindFloat(target, field, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseBindFont(target, field, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseBindInt(target, field, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseBindString(target, field, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        if (unbinders.size() - unbinderStartingSize > 1) {\n          throw new IllegalStateException(\n              \"More than one bind annotation on \" + targetClass.getName() + \".\" + field.getName());\n        }\n      }\n\n      for (Method method : targetClass.getDeclaredMethods()) {\n        Unbinder unbinder;\n\n        unbinder = parseOnCheckedChanged(target, method, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseOnClick(target, method, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseOnEditorAction(target, method, source);\n        if (unbinder != null) unbinders.add(unbinder);\n\n        unbinder = parseOnFocusChange(target, method, source);\n        if (unbinder != null) unbinders.add(unbinder);","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/JakeWharton/butterknife/blob/fcdebedf3276096db2f51bf6372b849b5a9c75ed/butterknife-reflect/src/main/java/butterknife/ButterKnife.java#L171-L207","documentation":"The reflective binder processes each declared field through parseBindView, parseBindBitmap, parseBindColor, and so on in sequence, counting how many unbinders were produced. More than one means the field carries multiple ButterKnife bind annotations (e.g. @BindView and @BindString together), which is ambiguous, so an IllegalStateException is thrown at bind time.","triggerScenarios":"Stacking annotations on one field, such as @BindView(R.id.title) @BindString(R.string.title) TextView title; a quick-fix IDE action adding a second bind annotation without removing the first.","commonSituations":"Changing a field from one resource type to another (e.g. @BindBitmap to @BindView) and leaving both annotations; copy-paste of annotated fields.","solutions":["Inspect the field named in the message and delete all but one ButterKnife annotation","If you need multiple values, split them into separate fields each with a single annotation"],"exampleFix":"// before\n@BindView(R.id.avatar) @BindBitmap(R.drawable.avatar) ImageView avatar;\n\n// after\n@BindView(R.id.avatar)\nImageView avatar;\n\n@BindBitmap(R.drawable.avatar)\nBitmap avatarBitmap;","handlingStrategy":"validation","validationCode":"// Before bind, assert each field carries at most one ButterKnife annotation\nfor (Field f : target.getClass().getDeclaredFields()) {\n  int count = 0;\n  for (Annotation a : f.getAnnotations()) {\n    if (a.annotationType().getName().startsWith(\"butterknife.\")) count++;\n  }\n  if (count > 1) throw new IllegalStateException(\"Multiple bind annotations on \" + f);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One ButterKnife annotation per field, always","When changing a field's annotation, delete the old one in the same edit","Enable IDE inspections for duplicate annotations"],"tags":["butterknife","runtime","reflection","misuse"],"backgroundTag":null,"analyzedSha":"fcdebedf3276096db2f51bf6372b849b5a9c75ed","analyzedAt":"2026-08-14T10:13:55.083Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}