android - 错误 : cannot find symbol class DataBindingComponet after merge two branches

标签 android android-gradle-plugin android-databinding

我遇到了一个非常奇怪的问题,我有两个分支并且分别工作正常。合并后,所有冲突都经过多次仔细解决。但是每次我们运行项目时都会出现这 3 个错误并且没有堆栈跟踪。

  1. error: cannot find symbol class DataBindingComponent

  2. error: cannot find symbol class DaggerLoginComponent

  3. Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.

停止注解处理器停止编译有问题,但我们没有找到任何原因但是我们手动检查了所有文件,但不知道我们如何调试问题并确定问题的根本原因。任何知道我们如何跟踪注解处理器未生成类的原因的人。

我们已经尝试了列出的方法。

  1. Clean -> Rebuild -> Invalidate Restart -> Delete all temporary files.

  2. run build with this command ./gradlew clean assemble --stacktrace --debug

  3. checked every resource and java files manually to find the issue.

我们使用了下面的库

  1. 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/

相关文章:

android-studio - 升级到 Gradle 3.3 后的 MissingTranslation 错误

java - Android:由于 transformDexArchiveWithExternalLibsDexMergerForDebug 程序类型已经存在,Java 库构建失败

android - 带有 DataBinding 的 RecyclerView 通用适配器

java - 访问 JSON 对象中的值

android - 如何将填充(或边距)设置为 android.support.v4.widget.DrawerLayout,但是

android - react native 错误:重复的资源, Assets 出现在某些屏幕中,而不出现在其他人的android版本APK中

android - Android数据绑定(bind)中不能引用其他View ID

java - 无法解决 sqlite、android 中 WHERE 附近的语法错误

java - AlertDialog在DialogFragment中不起作用

android-studio - Android 中的 AutoCompleteTextView 或 Spinner 数据绑定(bind)