无法解决“:app @ debugAndroidTest / compileClasspath”的依赖项:无法解决junit:junit:4.12

时间:2018-07-20 10:17:49

标签: java android junit

我正在学习android开发,并且最近更新了Android Studio,最后遇到标题中提到的问题,因为gradle无法同步。我检查了类似的问题,但没有一个解决方案对我有用。

  

无法解析':app @ debugAndroidTest / compileClasspath'的依赖关系:无法解析junit:junit:4.12。   打开文件   显示详细信息

在build.gradle(Module.app)文件中

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.1.0'
// TODO (1) Add RecyclerView dependency
androidTestImplementation 'com.android.support:recyclerview-v7:25.1.0'
// Instrumentation dependencies use androidTestCompile
// (as opposed to testCompile for local unit tests run in the JVM)
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:25.1.0'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test:rules:0.5'

}

在build.gradle(Project ....)文件中

    buildscript {
    repositories {
        jcenter() { url "http://jcenter.bintray.com/" }
        maven {
            url 'https://maven.google.com/'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.contains("windows")) {
        buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    }
    repositories {
        jcenter() { url "http://jcenter.bintray.com/" }
        maven {
            url 'https://maven.google.com/'
        }
        google()
    }
}

0 个答案:

没有答案
相关问题