Tag Archives: junit4

Android studio failed to resolve: junit:junit : 4.12 solutions

when importing someone else’s project in Android Studio, the project Failed to resolve: junit:junit:4.12:

solution:

1, direct comment out, this is actually a way to avoid mistakes;

2. Add maven:

to the build.gradle file under E:\android\app (project file directory)

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'http://repo1.maven.org/maven2' }
    }
}

or junit was deleted in file — Project Structure and then added again:

if it still doesn’t work, it’s best to change the version to match the current SDK for good.