2

I updated Android Studio to have 2.2 version. Unfortunately, I got this error (R is in red color) I reinstall Android studio but no change.. R still in red color

I did not even write any code

syn gradle

Error:Failed to resolve: org.hamcrest:hamcrest-core:1.1
<a href="openFile:C:/Users/MainUser/Desktop/LastTry/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>


Error:Failed to resolve: javax.inject:javax.inject:1
<a href="openFile:C:/Users/MainUser/Desktop/LastTry/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:Failed to resolve: com.google.code.findbugs:jsr305:2.0.1
<a href="openFile:C:/Users/MainUser/Desktop/LastTry/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

Error:Failed to resolve: com.squareup:javawriter:2.1.1
<a href="openFile:C:/Users/MainUser/Desktop/LastTry/app/build.gradle">Open File</a><br><a href="open.dependency.in.project.structure">Show in Project Structure dialog</a>

please I need help

azurefrog
  • 10,785
  • 7
  • 42
  • 56
Majazen ـG
  • 139
  • 1
  • 2
  • 8

3 Answers3

1

I had exactly the same problem. Go to File->Project Structure->app->dependencies and remove all the dependencies except these:

com.android.support:appcompat-v7:25.1.0       Compile  
com.android.support:design:25.1.0             Compile  
junit:junit:4.12                              Test compile

This will change the dependencies structure under build.gradle.

Hope this works!!

Dominik Kunicki
  • 1,037
  • 1
  • 12
  • 35
0

This may caused, your build to not compatible with current version.so, Open your root build.gradle file and change Gradle version like this

Old version:

dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    } 

New version:

dependencies {
        classpath 'com.android.tools.build:gradle:2.2.1'
    }

You can find further details ,For Gradle version compatibility see this.

uma
  • 1,477
  • 3
  • 32
  • 63
0

This is a common error in android studio. I fix it by doing build - clean. That usually works BUT if it doesnt, save and exit AndStudio and then restart

Ricky B
  • 3
  • 1