在遭受了findViewById的折磨之后,我决定使用ButterKnife,但是漂亮的bug告诉我,您永远不会使用ButterKnife,这是错误
@InjectView- Android框架包中注释错误的类。
为什么?我的错误在哪里?gradle dependency错了吗?
我看到了这个职位,但这对我没有帮助
分级文件(模块)
apply plugin: 'com.neenbedankt.android-apt'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
dependencies {
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
}这一行中的错误
@BindView(R.id.button_birth_date)
private Button buttonBirthDate;和使用@BindView的其他成员变量(视图)
发布于 2016-04-28 17:42:51
杰克·沃顿说,例外说的都是:
@InjectView-annotated class incorrectly in Android framework package. 你的课在Android框架包里,android..应用程序不应该使用android。或者java.*他们的代码包。ButterKnife将急切地拒绝这些包。
更改您的包裹名称。android.alcode.com.material到something.alcode.com.material
发布于 2017-03-16 08:34:23
您的包名不能包含android单词
因此,请确保
your application package名称不包含android word
发布于 2016-04-28 17:36:55
如果使用最后一个蝴蝶刀,则使用Butterknife.bind(this)而不是Butterknife.inject(this),视图使用@Bind(R.id.idview) not @InjectView(R.id.idview)。请参阅文档
编辑:更改您的包名,您不能使用android.*或java.*,杰克沃顿回答解决方案
https://stackoverflow.com/questions/36921700
复制相似问题