Android studio v2.2.2 error(27,17) failed to resolve junit:junit4.12

后端 未结 5 510
情深已故
情深已故 2020-12-20 18:33

I have searched everywhere for this answer and tried multiple ways to fix this but as I\'m new to this IDE I need a little help.

All I have done is created an empty

相关标签:
5条回答
  • 2020-12-20 19:26

    Remove the unwanted libraries from the build.gradle,

    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
      exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'
    

    and also

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    
    0 讨论(0)
  • 2020-12-20 19:26

    just remove :

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    
    0 讨论(0)
  • 2020-12-20 19:26

    configure proxy then you can able to download

    javax.inject:javax.inject:1
    javax.annotation:javax.annotation-api:1.2
    com.google.code.findbugs:jsr305:2.0.1
    org.hamcrest:hamcrest-library:1.3
    org.hamcrest:hamcrest-integration:1.3
    com.squareup:javawriter:2.1.1
    
    0 讨论(0)
  • 2020-12-20 19:33

    Don't remove the libraries that is not the way to do. This issue due to your internet connection. Set proxy connection in your gradle.properties file

    systemProp.http.proxyHost=hosturl
    org.gradle.jvmargs=-Xmx1536m
    systemProp.http.proxyPort=portnumber
    systemProp.http.proxyUser=username
    systemProp.http.proxyPassword=password
    
    systemProp.https.proxyHost=hosturl
    systemProp.https.proxyPort=portnumber
    systemProp.https.proxyUser=username
    systemProp.https.proxyPassword=password
    
    0 讨论(0)
  • 2020-12-20 19:35

    Add mavenCentral() to your repositories under jcenter() JCenter doesn't have those dependencies that you require.


    Edit: Also couldn't resolve the dependencies because of the proxy filtering traffic from and to maven.

    0 讨论(0)
提交回复
热议问题