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>

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

二、解决方案

 参考: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
    }

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

     
上一篇:C++ 元编程之代码生成:设计并实现拓扑结构 DSL


下一篇:Query DSL - Boosting Query