Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve junit:junit:4.12

后端 未结 2 709
感动是毒
感动是毒 2020-11-28 16:21

I create an new android project It shows errors on built

I tried the exiting answers

  • Failed to resolve: com.android.support:appcompat-v7 24.0.1
相关标签:
2条回答
  • 2020-11-28 16:31

    Add below repository in your build.gradle file,

    repositories {
          jcenter()
          maven {
            url 'https://maven.google.com'
        }
    }
    

    you forgot to add this to your dependencies

    androidTestCompile 'com.google.code.findbugs:jsr305:3.0.0' 
    

    The problem is caused by espresso library , if you can't remove it add this to your app gradle

    android
    { 
     configurations.all 
      { 
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9' 
      }
    }
    
    0 讨论(0)
  • 2020-11-28 16:50

    I was trying to mix AppCompat and Jetpack dependencies, and you cannot do that.

    I think I might not have the right repository setup for the Jetpack libraries (why it can't find any Jetpack libraries).

    Don't use: implementation 'androidx.appcompat:appcompat:1.0.2' . (this is Jetpack) -- use AppCompat versions of this (besides - Jetpack is NOT consistent with Appcompat versions earlier then 28.x). Bottom line, get rid of anything that says (androidx).

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
    }
    
    0 讨论(0)
提交回复
热议问题