Android Studio: Could not download junit.jar (junit:junit:4.12)

After the project goes online, how to reduce customers’ doubts about the delivery?Here is the secret script of three moves>>>

Download Android studio 3.1.4, create a new project, select activity, and the result will prompt gradle

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download junit.jar (junit:junit:4.12)
Open File
Show Details


Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not download junit.jar (junit:junit:4.12)
Open File
Show Details


Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not download junit.jar (junit:junit:4.12)
Open File
Show Details

solutions

1. Download JUnit

Click https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.jar , put it in…/Android studio/gradle/gradle-4.4/lib/plugins, and restart Android studio

However, the plugins will have JUnit package

2. Annotate the JUnit line in bulid. Gradle, and look at the figure. By the way, annotate Android test implementation

Similar Posts: