其他分享
首页 > 其他分享> > 3.1.0更新后,Android Studio无法生成数据绑定

3.1.0更新后,Android Studio无法生成数据绑定

作者:互联网

今天早上我从3.0.1到3.1.0更新了android studio.将gradle更新到最新版本后,我仍然会遇到有关数据绑定的构建错误.

我的gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

我的所有错误都如下所示:

/Users/mp/Documents/GitHub/projectx/app/build/generated/source/dataBinding/baseClasses/Staging/debug/me/projectx/asdasd/databinding/GridItemActivityTypeBinding.java:57: error: cannot find symbol
      @Nullable DataBindingComponent component) {
                ^
  symbol:   class DataBindingComponent
  location: class GridItemActivityTypeBinding

有没有人知道为什么我的数据绑定不会在android studio 3.1更新后生成?提前致谢

编辑1:忘了说,我试过清理/重建/无效缓存&重启/删除构建文件夹.

解决方法:

在更新到Android Studio 3.2后,此行适用于我.我在我的项目中运行了Java和Kotlin代码(编译器).

将以下内容添加到gradle.properties:
android.databinding.enableV2 = FALSE

原因:

Data Binding V2

Data Binding V2 is now enabled by default and is compatible with V1. This means that, if you have library dependencies that you compiled with V1, you can use them with projects using Data Binding V2. However, note that projects using V1 cannot consume dependencies that were compiled with V2.

来源(发行说明):https://developer.android.com/studio/releases/

标签:android,android-studio,android-studio-3-1
来源: https://codeday.me/bug/20191005/1856273.html