Skip to content Skip to sidebar Skip to footer

Failed To Resolve: Junit:junit:4.12

I just installed Android Studios on my work computer and I created a new blank project. However, I receive the following error. Failed to resolve: junit:junit:4.12 I have attempted

Solution 1:

JUnit is a unit testing framework for Java programming language.

JUnit has been important in the development of test-driven development .

At first modify your build.gradle from Project Level

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:2.2.1'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Duplicate

At first remove compile files('libs/junit-4.12.jar') from build.gradle( Module Level) section .

Then Clean-Rebuild-Gradle-Run .

Solution 2:

Try adding mavenCentral() as a repository, and also remove compile files('libs/junit-4.12.jar')

buildscript {
    ...
    repositories {
        mavenCentral()
    }
    ...
}

Post a Comment for "Failed To Resolve: Junit:junit:4.12"