Android Studio:ButterKnife 6.1.0 重复类:$$View Injector [英] Android Studio: ButterKnife 6.1.0 Duplicate Class: $$View Injector

查看:28
本文介绍了Android Studio:ButterKnife 6.1.0 重复类:$$View Injector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的项目从 Eclipse 迁移到 AS,因为我遇到了 65K 方法问题.在解决了我最初使用 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.

我在 Annotation Processors 中勾选了 Enable Annotation Processing 并给出了一个处理器路径.(甚至尝试从项目类路径中获取处理器)但是每当我运行该项目时,它都会出现以下错误:

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 的工作区导入项目时出现此问题.实际上它复制了src 文件夹中的$$ViewInjector.java 文件.因此,您需要手动从 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆