我試圖在我的Android應用上使用Google Play服務來獲取設備的最後一個已知位置,但是當我嘗試添加gradle這個依賴性:無法解析:com.google.android.gms:play-services:9.6.0同步項目時
compile 'com.google.android.gms:play-services:9.6.0'
我得到以下錯誤:
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
有誰知道如何解決這一問題?謝謝!
編輯
這是我的build.gradle文件:
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'
}
你可以分享你gradle這個文件? –