【错误记录】Android Studio 编译时 lint 检查报错 ( Could not resolve junit:junit:4.+. )
2023-06-13 09:18:05 时间
文章目录
一、报错信息
在 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 autosize原理,Android屏幕适配头条:autosize的原理
- Android resource linking failed_android sdk location should not
- android 系统浏览器 源码-Android 最最最简单的浏览器代码
- Android studio更新后出现警告:Warning:The `android.dexOptions.incremental` property is deprecated and it has
- 【错误记录】Android Studio 编译报错 ( e: Unknown JVM target version: 1.9 Supported versions: 1.6, 1.8, 9, 10 )
- 【错误记录】Android Studio 中 DataBinding 布局报错 ( Resources$NotFoundException: String resource ID #0xd )
- 【错误记录】Android Studio 导入外部 so 动态库报错 ( java.lang.UnsatisfiedLinkError | 指定 APK 打包动态库的 CPU 架构 )
- 【错误记录】AS 编译报错 ( Android Support plugin 版本太高 | 升级 Android Studio 到最新版本 )
- 【错误记录】Android Studio 编译时 Kotlin 代码编译报错 ( Not enough information to infer type variable T )
- 【错误记录】Android Studio 编译报错 ( AppCompat does not support the current theme features )
- 【错误记录】Android Studio 运行报错 ( There is not enough memory to perform the requested operation. )
- 【错误记录】Android Studio 配置 AspectJ 报错 ( all buildscript {} blocks must appear before any plugins {} )
- 【错误记录】Android Studio 编译报错 ( This Gradle plugin requires a newer IDE able to request IDE model leve )
- 【错误记录】Android Studio 配置 GitHub 报错 ( Can‘t login using given credentials: Request response: 401 Una )
- 【Android Gradle 插件】Module 目录下 build.gradle 配置文件 ( android 闭包块配置 | AppExtension 扩展类型参考文档 )
- 【错误记录】未安装该应用 ( 在 Android 12 之后 组件设置 android:exported=“false“ 属性 )
- 【错误记录】编译 Android 版本的 ijkplayer 报错 ( ./init-android.sh: 第 37 行: cd: android/contrib/: 没有那个文件或目录 )
- 【错误记录】Android Studio 中 Gradle 配置报错 ( Can‘t determine type for tag ‘<item name=““ type=“String“>)
- 【错误记录】Android Studio 编译时 lint 检查报错 ( Error: Google Play requires that apps target API level 29 or )
- 【错误记录】Unity 安卓打包报错( Platform Android with graphics API OpenGLES3 is not supported with HDRP )
- Android为何比iOS卡论1G内存的使用详解手机开发
- android fragement报nullexcption错误详解手机开发
- Android Studio 导入项目 出现安装Error:Cause: failed to find target with hash string ‘android-23’ 等错误详解手机开发