符号 class 构建项目时找不到绑定

symbol class Bind cannot be found while building project

开发人员您好我遇到了此代码的问题。

构建模块如下:

   dependencies {
       final SUPPORT_LIB_VERSION = '27.0.2'
        final COLOR_PICKER_VERSION = '1.5'
        final BUTTER_KNIFE_VERSION = '8.4.0'

        compile fileTree(dir: 'libs', include: ['*.jar'])

        compile 'com.google.android.gms:play-services-ads:11.8.0'
        //noinspection GradleCompatible
        compile "com.android.support:appcompat-v7:27.0.2"
        compile "com.larswerkman:HoloColorPicker:1.5"
        compile "com.jakewharton:butterknife:8.4.0"

        compile project(':library')
    }

当我尝试 运行 时,此错误显示:

Error:(17, 19) error: cannot find symbol class Bind at specific java files

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Color picker
 */
public class ColorPickerDialogFragment extends DialogFragment {

    public static final String KEY_INDEX = "INDEX";
    public static final String KEY_COLOR = "COLOR";
    @Bind(R.id.picker)
    ColorPicker colorPicker;
    @Bind(R.id.svbar)
    SVBar svBar;
    @Bind(R.id.btn_save)
    Button btnSave;

对于 ButterKnife 8.4.0,您需要使用 BindView:

class ExampleActivity extends Activity {
  @BindView(R.id.user) EditText username;
  @BindView(R.id.pass) EditText password;

  @BindString(R.string.login_error) String loginErrorMessage;

  @OnClick(R.id.submit) void submit() {
    // TODO call server...
  }

  @Override public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.simple_activity);
    ButterKnife.bind(this);
    // TODO Use fields...
  }
}