44.Error:(xx, yy) Failed to resolve: junit:junit:4.12

Error:(23, 17) Failed to resolve: junit:junit:4.12?

把testCompile 'junit:junit:4.12'注释或删除掉,在stackoverflow中有明确的原由和解决方法,只需在Application的build.gradle文件中添加
maven { url 'http://repo1.maven.org/maven2' }

具体如下所示:

android {
    [...]
    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }
    [...]
}

工程的build.gradle完整如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        applicationId "com.diudiu.myapplicationtest"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    repositories {
        maven { url 'http://repo1.maven.org/maven2' }
    }

    
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    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'
    })
    compile 'com.android.support:appcompat-v7:25.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

}

你可能感兴趣的:(44.Error:(xx, yy) Failed to resolve: junit:junit:4.12)