我想在我的應用程序中使用一些Google服務,因此我已將此行添加到.gradle
文件:com.google.android.gms:play-services-gcm:8.7+
。但是,試圖同步的項目後,我得到這個錯誤:無法解決:com.google.android.gms:play-services-gcm:8.7+
Failed to resolve: com.google.android.gms:play-services-gcm:8.7+
我檢查了所有可用的答案#2。他們建議安裝sdk的Google repository
和Google play services
,我做到了。這是安裝在我的計算機上的軟件開發工具包截圖:
這裏是gradle這個文件代碼:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.project.android.eyedetection"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/localization/LocalizedFormats_fr.properties'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile project(':libraries:opencv')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.android.gms:play-services:8.7+'
compile files ('libs/commons-math-2.2.jar')
compile files ('libs/commons-math-2.2-javadoc.jar')
compile files ('libs/commons-math-2.2-sources.jar')
}
我試圖刪除+
,但這並沒有解決這個問題。
我該如何解決問題?
編輯:作爲建議的Stanojkovic和加布裏埃萊馬里奧蒂使用8.4解決了這個問題,這是因爲我被錯誤地試圖使用8.7還未被釋放。謝謝大家。
是否要設置Google Cloud Messaging? – Stanojkovic
謝謝您的評論。不,我想使用Mobile Vision API檢測面部標誌。我該如何解決這個問題? – Dania
試用com.google.android.gms:play-services-panorama:8.4.0 – Stanojkovic