3

It's showing me an error of failure to resolve dependency:

Error:(25, 13) Failed to resolve: com.google.android.gms:play-services-maps:11.4.0

These are the dependencies i'm using:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.android.gms:play-services-maps:11.4.0'

}

What should I do?

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Hadi Abu
  • 1,359
  • 1
  • 10
  • 14

2 Answers2

11

To use the 11.4.0 you have to add maven { url "https://maven.google.com" } to your build.gradle file

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • tried it. but it still showed an error. – Hadi Abu Sep 26 '17 at 13:37
  • @HadiAbu Post your updated build.gradle and the error message. – Gabriele Mariotti Sep 26 '17 at 14:22
  • It worked. before i had two different dependency versions for maps and locations: compile 'com.google.android.gms:play-services-maps:11.4.0' compile 'com.google.android.gms:play-services-location:11.0.4'. but i changed it to be of the same version and it worked: compile 'com.google.android.gms:play-services-maps:11.4.0' compile 'com.google.android.gms:play-services-location:11.4.0' – Hadi Abu Sep 27 '17 at 11:07
4

turned out that the google-maps dependency should be:

compile 'com.google.android.gms:play-services-maps:11.0.4'

and not

compile 'com.google.android.gms:play-services-maps:11.4.0'
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
Hadi Abu
  • 1,359
  • 1
  • 10
  • 14