错误记录Android Studio 编译时 lint 检查报错 ( Could not resolve junit:junit:4.+. )
Posted 韩曙亮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录Android Studio 编译时 lint 检查报错 ( Could not resolve junit:junit:4.+. )相关的知识,希望对你有一定的参考价值。
文章目录
一、报错信息
在 android Studio 中的 Terminal 面板中 , 执行
gradlew :app:lintDebug
命令 ,
进行 lint 检查 , 测试代码结构 , 报如下错误 :
Y:\\002_WorkSpace\\001_AS\\SVG>gradlew :app:lintDebug
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 8s
二、解决方案
1、方案一
将 dependencies 中的 testImplementation ‘junit:junit:4.+’ 注释掉 ;
dependencies
//testImplementation 'junit:junit:4.+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
// 矢量图支持库 , 支持 5.0 以下版本手机使用矢量图 , 这个是创建应用时自带的配置
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
2、方案二
配置
maven
url 'http://repo1.maven.org/maven2'
远程仓库 ;
以上是关于错误记录Android Studio 编译时 lint 检查报错 ( Could not resolve junit:junit:4.+. )的主要内容,如果未能解决你的问题,请参考以下文章
错误记录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‘. )