Butterknife
私は@bindView
を使用してボタンに注釈を付けます。 しかし、それはエラーが起こった。 Required view 'hello' with ID 2131427413 for field 'hello' was not found.
butterknifeフィールド 'hello'のID '2131427413'が必要なビュー 'hello'が見つかりませんでした
@BindView(R.id.hello)
Button hello;
@Inject
GitHubApiService gitHubApiService;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ButterKnife.bind(this);
hello.setText("hello");
}
butterknifeの依存関係
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'//这个是自定义注解用的编译插件
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
}
}
あなたは '活動のsetContentView' –
あなたはプロジェクトをきれいにしようとすることができませんでした –