错误:无法解析“:app @ debugAndroidTestcompileClasspath”的依赖项:无法解析junit:junit:4.12

错误:无法解析“:app @ debugAndroidTestcompileClasspath”的依赖项:无法解析junit:junit:4.12,第1张

概述我创建了一个新的android项目,它在构建时显示错误我尝试了现有的答案> Failed to resolve: com.android.support:appcompat-v7 24.0.1>我试图使Android Studio无效并重新启动错误是 Error:Unable to resolve dependency for ':app

我创建了一个新的android项目,它在构建时显示错误

我尝试了现有的答案

> Failed to resolve: com.android.support:appcompat-v7 24.0.1
>我试图使AndroID Studio无效并重新启动

错误是

Error:Unable to resolve dependency for
‘:app@deBUGAndroIDTest/compileClasspath’: Could not resolve
junit:junit:4.12.

Error:Unable to resolve dependency for
‘:app@releaseUnitTest/compileClasspath’: Could not resolve
junit:junit:4.12.

Error:Unable to resolve dependency for
‘:app@deBUGUnitTest/compileClasspath’: Could not resolve
junit:junit:4.12.

Error:Unable to resolve dependency for
‘:app@deBUGAndroIDTest/compileClasspath’: Could not resolve
com.Google.code.findBUGs:Jsr305:2.0.1.

我的gradle文件的依赖项部分

 dependencIEs     {       implementation 'androIDx.appcompat:appcompat:1.0.2'    testImplementation 'junit:junit:4.12'    }

我不明白这是我的第一个项目.

我的项目gradle是

// top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    repositorIEs {        Google()        jcenter()    }    dependencIEs {        classpath 'com.androID.tools.build:gradle:3.4.1'        // NOTE: Do not place your application dependencIEs here; they belong        // in the indivIDual module build.gradle files    }}allprojects {    repositorIEs {        jcenter()        maven {            url 'https://maven.Google.com'        }    }}task clean(type: Delete) {    delete rootProject.buildDir}

我的应用程式gradle是

apply plugin: 'com.androID.application'androID {    compileSdkVersion 29    buildToolsversion "29.0.0"    defaultConfig {        applicationID "com.example.myapplication"        minSdkVersion 28        targetSdkVersion 29        versionCode 1        versionname "1.0"        testInstrumentationRunner "androIDx.test.runner.AndroIDJUnitRunner"    }    buildTypes {        release {            MinifyEnabled false            proguardfiles getDefaultProguardfile('proguard-androID-optimize.txt'),'proguard-rules.pro'        }    }}androID        {            configurations.all                    {                        resolutionStrategy.force 'com.Google.code.findBUGs:Jsr305:1.3.9'                    }        }dependencIEs        {    implementation 'androIDx.appcompat:appcompat:1.0.2'    testImplementation 'junit:junit:4.12'}
最佳答案在build.gradle文件中添加以下存储库,

repositorIEs {      jcenter()      maven {        url 'https://maven.Google.com'    }}

您忘了将此添加到您的依赖项

androIDTestCompile 'com.Google.code.findBUGs:Jsr305:3.0.0' 

问题是由espresso库引起的,如果您无法删除它,请将其添加到应用程序gradle中

androID{  configurations.all   {     resolutionStrategy.force 'com.Google.code.findBUGs:Jsr305:1.3.9'   }}
总结

以上是内存溢出为你收集整理的错误:无法解析“:app @ debugAndroidTest / compileClasspath”的依赖项:无法解析junit:junit:4.12 全部内容,希望文章能够帮你解决错误:无法解析“:app @ debugAndroidTest / compileClasspath”的依赖项:无法解析junit:junit:4.12 所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1145094.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存