如果在编译期间有任何错误,则不会生成数据绑定类 - 因此,我得到了大量的错误,如下所示:
symbol: class DataBindingComponent
location: class TrainingActivityCompletedSetBinding
e: S:\ProjectLocation\TrainingActivityCompletedSetBinding.java:60: error: cannot find symbol
@Nullable DataBindingComponent component)
Run Code Online (Sandbox Code Playgroud)
问题是编译错误根本不与数据绑定有关,因此我不知道实际上是什么导致它 - 我必须手动挖掘文件才能找到问题.
在上面的例子中,我只是@Inject从需要它的构造函数中省略.在这种情况下看到来自Dagger的错误消息是很可爱的,这样我就可以立即找到它,而不必深入挖掘所有项目类来手动找到它.
任何帮助将大大感激!
Android Studio和数据绑定目前都是3.1.3版本,至少从3.0开始就出现了错误.
使用Kotlin V1.2.41和kapt生成代码.
尝试增加编译器显示的最大错误数,遗憾的是没有区别.
暂时,解决方法是android.databinding.enableV2=true在gradle.properties中简单地禁用数据绑定V2 : . 尽管如此,仍然需要更好的解决方案
我下载了一个Android项目,但是我收到了这个错误:
Error:(42, 42) error: cannot find symbol class DataBindingComponent
Run Code Online (Sandbox Code Playgroud)
样品导入:
import android.databinding.DataBindingComponent; // no code-time error
import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
Run Code Online (Sandbox Code Playgroud)
样品用法:
public FragmentFantasyPointsSingleBinding(DataBindingComponent bindingComponent, View root) {
super(bindingComponent, root, 0);
Object[] bindings = ViewDataBinding.mapBindings(bindingComponent, root, 4, sIncludes, sViewsWithIds);
this.animationView = (LottieAnimationView) bindings[3];
this.mboundView0 = (FrameLayout) bindings[0];
this.mboundView0.setTag(null);
this.progressView = (LinearLayout) bindings[2];
this.recyclerView = (RecyclerView) bindings[1];
setRootTag(root);
invalidateAll();
}
Run Code Online (Sandbox Code Playgroud)
代码时间没有错误,但在编译时我得到了我提到的错误.
当我尝试在Android Studio上进行定义时,我不能.
应用程序级build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.esports.flank"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName …Run Code Online (Sandbox Code Playgroud)