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'

}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容