我在嘗試將我的根build.gradle文件中的Google Play服務添加到類路徑時出現錯誤。我試圖遵循火力教程,並指出把類路徑「com.google.gms:播放服務:11.0.4'into根gradle這個文件將播放服務添加到build.gradle時出現錯誤
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:play-services:11.0.4'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
不過,我發現了以下錯誤:
Error:Could not find com.google.gms:play-services:11.0.4.
Searched in the following locations:
file:/home/graffixnyc/android-studio/gradle/m2repository/com/google/gms/play-services/11.0.4/play-services-11.0.4.pom
file:/home/graffixnyc/android-studio/gradle/m2repository/com/google/gms/play-services/11.0.4/play-services-11.0.4.jar
https://jcenter.bintray.com/com/google/gms/play-services/11.0.4/play-services-11.0.4.pom
https://jcenter.bintray.com/com/google/gms/play-services/11.0.4/play-services-11.0.4.jar
Required by:
project :
現在我注意到的是它在尋找/home/graffixnyc/android-studio/gradle/m2repository/com/google/gms/play-services/11.0.4/play-services-11.0。 4.pom
但是,我的位置:/ home/graffixnyc/android-sdk/extras/google/m2repository/com/google/android/gms/play-services/11.0.4
我的SDK一直在這個位置,所以我不確定爲什麼它在/home/graffixnyc/android-studio/gradle/m2repository/com/google/gms/play-services/11.0中查找。 4
如何讓Android Studio在正確的位置識別它?