Android数据绑定吞噬了其他编译​​器的错误 [英] Android databinding swallows errors from other compilers

查看:87
本文介绍了Android数据绑定吞噬了其他编译​​器的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在编译过程中发生任何错误,则将生成数据绑定类arent,因此,我会收到大量这样的错误:

If there are any errors during compilation, the databinding classes arent generated - and as such, I get a ton of errors like this:

  symbol:   class DataBindingComponent
  location: class TrainingActivityCompletedSetBinding
  e: S:\ProjectLocation\TrainingActivityCompletedSetBinding.java:60: error: cannot find symbol
  @Nullable DataBindingComponent component)

问题在于编译错误根本与数据绑定无关,因此我不知道到底是什么原因导致的-我必须手动挖掘文件才能发现问题.

在上面的示例中,我只是从需要它的构造函数中省略了@Inject.在这种情况下,很高兴看到Dagger发出的错误消息,这样我就可以立即找到它,而不必深入研究所有项目类来手动找到它.

In the example above, I just omitted @Inject from a constructor that requires it. Itd be lovely to see the error message from Dagger in this case so that I can find it immediately, rather than having to dig into all the projects classes to find it manually.

任何帮助都将得到极大的感谢!

Any help would be greatly appreciated!

Android Studio&数据绑定当前在版本3.1.3上,至少从3.0开始存在此错误.

Both Android Studio & Databinding is on version 3.1.3 currently, the error has been there since 3.0 at least.

使用Kotlin V1.2.41,并使用kapt生成代码.

Using Kotlin V1.2.41, and kapt for generating code.

尝试增加编译器将显示的最大错误数,不幸的是没有差别.

Tried increasing the max number of errors the compiler would show, unfortunately no difference.

暂时,一种解决方法是简单地禁用 gradle.properties 中的数据绑定V2:android.databinding.enableV2=true.不过,仍然可以寻求更好的解决方案.

Temporarily, a workaround is to simply disable databinding V2: android.databinding.enableV2=true in gradle.properties. Still open to a better solution though.

推荐答案

无法写评论,所以在这里写. 可能您想说要添加这样的一行:android.databinding.enableV2=false,这样就可以正常工作.

Cannot write a comment, so I'll write it here. Probably you wanted to say to add a line like this: android.databinding.enableV2=false, so it'll work right.

这篇关于Android数据绑定吞噬了其他编译​​器的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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