Android Studio:ButterKnife 6.1.0重复的类:$$ View Injector [英] Android Studio: ButterKnife 6.1.0 Duplicate Class: $$View Injector
问题描述
当我遇到65K方法问题时,我将项目从Eclipse迁移到了AS.修复了我最初使用AS遇到的每个依赖性问题之后,我陷入了这个问题,无论我从博客和SO本身的其他类似帖子中尝试什么,这一问题似乎都不会消失.
I migrated my project to AS from Eclipse as I was getting 65K methods issue. After fixing every dependency issue that I was facing initially with AS, I got stuck with this issue which doesn't seem to go away no matter what I try from the other similar posts from around the blogs and SO itself.
我在注释处理器中检查了启用注释处理,并给出了处理器路径. (甚至尝试从项目类路径中获取处理器),但是每当我运行项目时,都会出现以下错误:
I checked Enable Annotation Processing in Annotation Processors and also gave a processor path. (even tried with Obtain processor from project classpath) but whenever I run the project it gives the following error:
Error:(8, 8) error: duplicate class: list.EventsListAdapter$ViewHolder$$ViewInjector
Error:Execution failed for task ':ProjectDemo:compileDebugJava'.
Compilation failed; see the compiler error output for details.
在我的gradle文件中,我按照其他人的建议添加了以下内容:
In my gradle file, I added the following as per the suggestions by others:
applicationVariants.all { variant ->
variant.outputs.each { output ->
def file = output.outputFile
output.outputFile = new File(file.parent, file.name.replace(".apk", "-" + defaultConfig.versionName + ".apk"))
}
}
但是结果是一样的.
我做错了什么?另外,如果您需要更多详细信息,请告诉我.我是AS的新手,可能错过了一些显而易见的东西.
What am I doing wrong? Also, let me know if you want more details regarding this. I'm kinda new to AS and might have missed something obvious.
先谢谢了.
推荐答案
我也遇到了这个问题.用户从eclipse的工作区中导入项目时,会发生此问题.实际上,它会将$$ViewInjector.java
文件复制到您的src
文件夹中.因此,您需要手动将它们从src
软件包中删除.
I also faced this issue. This issue occurred when user imported project from eclipse's workspace. Actually it copies the $$ViewInjector.java
files in your src
folder. So you need to delete them from your src
packages manually.
这篇关于Android Studio:ButterKnife 6.1.0重复的类:$$ View Injector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!