Android could not resolve error

If you are sure there are no spelling errors in your dependency and that the project is hosted at the correct repo then most likely the issue is gradle

Often you will get an error like failed to resolve ...

Which may make it Unable to compile on Android Studio 2 and sometimes Android studio 1.

Sometimes you might also get an error like peer not authenticated

The solution

  1. Change distributionUrl in gradle-wrapper.properties to the latest gradle

  2. Run gradle wrapper task from command line

cd ~/AndroidStudioProject/myproject/ myapp ./gradlew tasks

Sources: