其他分享
首页 > 其他分享> > Android编译出现DSL element android.dataBinding.enabled is obsolete and has been replaced with android

Android编译出现DSL element android.dataBinding.enabled is obsolete and has been replaced with android

作者:互联网

一、问题

  编译的时候发现,发现以下警告,大概意思是

  DSL元素的android.dataBinding。已被替换为“android.buildFeatures.dataBinding”,它将在5.0版的Android Gradle插件中被删除。

build.gradle: DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'.
It will be removed in version 5.0 of the Android Gradle plugin.
Affected Modules: <a href="openFile:F:/baseDemo/app/build.gradle">app</a>

二、解决方案

 参考:https : //developer.android.com/studio/preview/features#agp-4-0-0,发现从Android Gradle Plugin4.0.0 开始,有一个被称为buildFeatures启用构建功能的模块,所以要使用新的AGP插件启用数据绑定,得改为以下配置:

buildFeatures{
        dataBinding = true
        // for view binding :
        // viewBinding = true
    }

     

标签:enabled,obsolete,Gradle,buildFeatures,DSL,dataBinding,android,Android
来源: https://blog.csdn.net/qq_40533422/article/details/106838495