Android Studio 3.0.1 unable to resolve dependency error

Viewed 4544

Hello I am new to Android Studio.

Just installed latest 3.0.1 on windows 7.

I am getting gradle dependency error and I am not able to even start my first basic project.

I have tried each and every method i found on this site or anywhere on internet but nothing worked.

Please help me, The errors are.

Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve junit:junit:4.12.
Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.squareup:javawriter:2.1.1.
Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve javax.inject:javax.inject:1.
Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve org.hamcrest:hamcrest-library:1.3.
Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve org.hamcrest:hamcrest-integration:1.3.
Error:Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.google.code.findbugs:jsr305:2.0.1.
Error:Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve junit:junit:4.12.
Error:Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve junit:junit:4.12.

enter image description here

enter image description here

Thank you.

3 Answers
  1. In your Settings > Build,Execution,Deployment > Gradle, Make sure offline work is not enabled and also make sure you are using the default gradle wrapper (Recommended) in the same menu.
  2. Now in your top level Build Gradle file just delete the following

    maven {
       url "https://maven.google.com"
    } 
    

    You don't really need that.

  3. Now in your app level build gradle file change all the compileOnly to implementation
  4. sync gradle
  5. Clean project
Related