我遇到了一个非常奇怪的问题,我有两个分支并且分别工作正常。合并后,所有冲突都经过多次仔细解决。但是每次我们运行项目时都会出现这 3 个错误并且没有堆栈跟踪。
error: cannot find symbol class DataBindingComponent
error: cannot find symbol class DaggerLoginComponent
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
停止注解处理器停止编译有问题,但我们没有找到任何原因但是我们手动检查了所有文件,但不知道我们如何调试问题并确定问题的根本原因。任何知道我们如何跟踪注解处理器未生成类的原因的人。
我们已经尝试了列出的方法。
Clean -> Rebuild -> Invalidate Restart -> Delete all temporary files.
run build with this command ./gradlew clean assemble --stacktrace --debug
checked every resource and java files manually to find the issue.
我们使用了下面的库
- lombok 1.16.20, databinding , dagger 2.16 that are using annotation processor
我们在维度、字符串和样式文件中存在冲突。非常仔细地解决了这些问题。
如果需要更多信息,我会提供。
Updated: Finally get a solution There was a private static import in other class that causes this problem Make Sure You don't have any java compiler issue, Even small syntax issue will not compile your binding and I don't know why the error is not printing in logcat. Hope It will resolve in the updated android studio.
最佳答案
加起来评论,这两次都发生在我身上,都与 Dagger 有关。
- 在 Dagger 模块类中 Unresolved 导入。花了 4 个小时才找到这个
@Inject
对抽象类的注释。花了 2 天时间才找到这个
知道 W*F 错误的工作流程是:
- 在小型项目中,检查所有类和布局可能是一个可行的选择
- 如果可以,返回提交以到达最后一个工作点,然后从那里看。这几乎是无用的建议,因为这种讨厌的事情通常发生在您进行某种重构的过程中
- 创建一个破坏性分支并尽一切可能使用旧数据绑定(bind)编译器,
android.databinding.enableV2=false
。这样做可能需要您删除模块,删除您正在使用的新功能(例如,非功能模块中的实验性数据绑定(bind)),可能会降级 AGP。但这是值得的,因为旧的数据绑定(bind)编译器实际上会告诉您错误,而不是这个找不到符号
的困惑。
祝你在这个令人筋疲力尽的过程中好运,如果可以的话,请向数据绑定(bind)人员提交错误报告。
关于android - 错误 : cannot find symbol class DataBindingComponet after merge two branches,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51318015/