您当前的位置: 首页 >  junit

暂无认证

  • 3浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

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

发布时间:2022-05-11 23:07:09 ,浏览量:3

文章目录
  • 一、报错信息
  • 二、解决方案
    • 1、方案一
    • 2、方案二
一、报错信息

在 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' } 

远程仓库 ;

关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.3880s