Butterknife
我用@bindView
注释按钮。 但它发生了一个错误。 Required view 'hello' with ID 2131427413 for field 'hello' was not found.
butterknife所需的视图“你好” ID为2131427413的现场“你好”没有被发现
@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' –
你可以尝试清洁工程 –