JakeWharton/butterknife · error · IllegalStateException

@BindViews must specify at least one ID. (

Error message

@BindViews must specify at least one ID. (

What it means

parseBindViews requires at least one view ID in the annotation's value array; an empty `@BindViews({})` (or relying on an empty default) produces nothing to bind and throws this IllegalStateException at bind time. The processor flavor reports the equivalent error at compile time.

Source

Thrown at butterknife-reflect/src/main/java/butterknife/ButterKnife.java:308

    } else {
      throw new IllegalStateException("@BindViews must be a List or array. ("
          + field.getDeclaringClass().getName()
          + '.'
          + field.getName()
          + ')');
    }
    if (!View.class.isAssignableFrom(viewClass) && !viewClass.isInterface()) {
      throw new IllegalStateException(
          "@BindViews List or array type must extend from View or be an interface. ("
              + field.getDeclaringClass().getName()
              + '.'
              + field.getName()
              + ')');
    }

    int[] ids = bindViews.value();
    if (ids.length == 0) {
      throw new IllegalStateException("@BindViews must specify at least one ID. ("
          + field.getDeclaringClass().getName()
          + '.'
          + field.getName()
          + ')');
    }

    List<Object> views = new ArrayList<>(ids.length);
    String who = "field '" + field.getName() + "'";
    for (int id : ids) {
      Object view = Utils.findOptionalViewAsType(source, id, who, viewClass);
      if (view != null) {
        views.add(view);
      }
    }

    Object value;
    if (isArray) {
      Object[] viewArray = (Object[]) Array.newInstance(viewClass, views.size());

View on GitHub (pinned to fcdebedf32)

Solutions

  1. Supply one or more valid view IDs: @BindViews({R.id.first, R.id.second})
  2. Remove the annotation and field entirely if no views need binding

Example fix

// before
@BindViews({})
List<TextView> labels;

// after
@BindViews({R.id.first, R.id.second})
List<TextView> labels;
Defensive patterns

Strategy: validation

Validate before calling

if (bindViews.value().length == 0) {
  throw new IllegalStateException("@BindViews with no IDs");
}

Prevention

When it happens

Trigger: Writing @BindViews({}) with an empty array literal; generating the annotation from code/templating that yields zero IDs; clearing IDs during debugging.

Common situations: Placeholder code committed with empty annotation values; build-time generated binding code with missing ID lists.

Related errors


AI-assisted analysis of JakeWharton/butterknife@fcdebedf32 (2026-08-14). Data as JSON: /api/errors/f03659b77d7d3921. Report an issue: GitHub.