错误记录Android Studio 编译时 lint 检查报错 ( WARNING: DSL element ‘android.dataBinding.enabled‘ is obsolet )

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录Android Studio 编译时 lint 检查报错 ( WARNING: DSL element ‘android.dataBinding.enabled‘ is obsolet )相关的知识,希望对你有一定的参考价值。

文章目录





一、报错信息



android Studio 中的 Terminal 面板中 , 执行

gradlew :app:lintDebug

命令 ,

进行 lint 检查 , 测试代码结构 , 报如下错误 :

Y:\\002_WorkSpace\\001_AS\\SVG>gradlew :app:lintDebug
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :app
WARNING: 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.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintDebug'.
> Could not resolve all artifacts for configuration ':app:debugUnitTestCompileClasspath'.
   > Could not resolve junit:junit:4.+.
     Required by:
         project :app
      > Failed to list versions for junit:junit.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/junit/junit/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/junit/junit/maven-metadata.xml'.
               > org.apache.http.client.ClientProtocolException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s





二、解决方案



将 " build.gradle # android " 中的

android 
    dataBinding 
        enabled = true
    

配置 , 修改为

android 
    buildFeatures 
        dataBinding = true
    

以上是关于错误记录Android Studio 编译时 lint 检查报错 ( WARNING: DSL element ‘android.dataBinding.enabled‘ is obsolet )的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 编译时 Kotlin 代码编译报错 ( Not enough information to infer type variable T )

错误记录Android Studio 编译时 lint 检查报错 ( Could not resolve junit:junit:4.+. )

错误记录Android Studio 编译报错 ( Invalid Gradle JDK configuration found )

错误记录Android Studio 编译时 lint 检查报错 ( Error: Google Play requires that apps target API level 29 or )

错误记录Android Studio 编译报错 ( Execution failed for task ‘:APP_MIDI:lintVitalRelease‘. )

错误记录Android Studio 编译报错 ( Execution failed for task ‘:APP_MIDI:lintVitalRelease‘. )