gpt4 book ai didi

Android Studio 3.1.0 更新后无法生成数据绑定(bind)

转载 作者:IT老高 更新时间:2023-10-28 21:41:10 25 4
gpt4 key购买 nike

今天早上我将 android studio 从 3.0.1 更新到 3.1.0。将 gradle 更新到最新版本后,我仍然收到有关数据绑定(bind)的构建错误。

我的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

有谁知道为什么我的数据绑定(bind)不会在 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 Studio 3.1.0 更新后无法生成数据绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49514488/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com