我将我的项目从 Eclipse 迁移到 AS,因为我遇到了 65K 方法问题。在解决了我最初使用 AS 时遇到的每个依赖性问题后,我陷入了这个问题,无论我从博客和 SO 本身的其他类似帖子中尝试什么,这个问题似乎都没有消失。
我在 Annotation Processors 中勾选了 Enable Annotation Processing 并且还给出了一个处理器路径。 (甚至尝试从项目类路径获取处理器)但每当我运行项目时,它都会出现以下错误:
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文件中,我根据其他人的建议添加了以下内容:
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 有点陌生,可能错过了一些明显的东西。
提前致谢。
最佳答案
我也遇到过这个问题。当用户从 Eclipse 的工作区导入项目时会发生此问题。实际上,它会复制 $$ViewInjector.java
文件到您的 src
文件夹中。所以你需要手动从你的 src
包中删除它们。
关于Android Studio : ButterKnife 6. 1.0 重复类:$$View Injector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32219175/