Tuco Tuco - 2 months ago 55
Android Question

Failed to resolve: com.google.android.gms:play-services:9.6.0 when syncing project

I'm trying to use Google Play Services on my Android app to get the device's last known location, but when I try to add the gradle dependency:

compile 'com.google.android.gms:play-services:9.6.0'


I get the following error:

A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.google.android.gms:play-services:9.6.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services/9.6.0/play-services-9.6.0.pom
https://jcenter.bintray.com/com/google/android/gms/play-services/9.6.0/play-services-9.6.0.jar
file:/home/user/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services/9.6.0/play-services-9.6.0.pom
file:/home/user/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services/9.6.0/play-services-9.6.0.jar
file:/home/user/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services/9.6.0/play-services-9.6.0.pom
file:/home/user/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services/9.6.0/play-services-9.6.0.jar


Does anyone know how to fix this? Thanks!

EDIT

Here's my build.gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 24
buildToolsVersion "24.0.2"

defaultConfig {
applicationId "app"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}


buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
abortOnError false
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile group: 'org.powermock', name: 'powermock-mockito-release-full', version: '1.6.4'
compile 'org.mockito:mockito-core:1.10.19'
compile 'com.google.android.gms:play-services:9.6.0'
}

Answer

Update your SDK's Android Support Repository and Google Play services first. See if it syncs after.