一、报错信息
在 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
}
}