22

根據this SO線程,我知道存在版本衝突,但問題仍然存在谷歌的新版本後。錯誤:修復版本衝突(谷歌服務插件)

Error:Execution failed for task ':app:processDebugGoogleServices'. Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.1.

的build.gradle(模塊:APP)

.... 
dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:26.+' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
    compile 'com.google.firebase:firebase-messaging:10.0.1' 
    compile 'com.google.android.gms:play-services-maps:11.0.4' 
    compile 'com.google.android.gms:play-services-location:11.0.4' 
} 

apply plugin: 'com.google.gms.google-services' 


現在需要什麼樣的改變?

回答

28

我想你更改

compile 'com.google.firebase:firebase-messaging:11.0.4' 
+1

所以,只有這個問題!我希望在發佈之前嘗試過它:\ –

+0

好吧,繼續吧! –

+2

確保所有Firebase SDK版本與播放服務版本相同。 –

11

在谷歌播放服務要求其所有依賴於具有相同的版本。但是,如果你看看你的依賴:

compile 'com.google.firebase:firebase-messaging:10.0.1' 
compile 'com.google.android.gms:play-services-maps:11.0.4' 
compile 'com.google.android.gms:play-services-location:11.0.4' 

有一個有不同的版本。

它可以通過將版本更改爲(在這種情況下)11.0.4來解決。

這適用於Firebase和Google Play服務 - 兩者必須具有相互匹配的匹配版本。如果Firebase依賴項爲10.0.1,且Google Play服務依賴項爲11.0.4,則會發生相同的錯誤。

注意,在某些情況下,可以有不同的版本的庫庫(如圖書館x使用play-services-games:10.0.1,而你使用11.0.4在您的應用程序的依賴關係)

16

您只能使用版本3個庫

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

或僅只使用10.0.1 3庫

-2

安裝或更新谷歌播放服務。其次,請檢查您的'com.google.gms:google-services:3.0.0'版本。檢查,通過升級它,如果仍然無法工作到3.1.0

6

應用插件時會拋出相同的錯誤:'com.google.gms.google-services'未添加到模塊的底部build.gradle文件。

+0

這篇文章看起來不像是試圖回答這個問題。預計這裏的每一篇文章都會明確地試圖回答這個問題。如果您有批評意見或需要澄清問題或其他答案,您可以[直接在其下面發表評論](// stackoverflow.com/help/privileges/comment)(如本文所述)。請刪除此答案並創建一條評論或一個新問題。請參閱:[提問,獲得答案,沒有分心](// stackoverflow.com/tour) – LW001

+1

爲什麼這不是問題的答案?這是對這個問題的回答,對於面臨與我提到的場景相同問題的人有用。 –

+0

這爲我工作,我只是將其添加到文件的底部 – SolidSnake

0

最初,firebase數據庫指向11.8.0。在將所有相關的hars更改爲11.0.4後,此問題在SDK 編譯'com.google.firebase:firebase-database:11.0.4' compile'c​​om.google.firebase:firebase-messaging:11.0.4'

相關問題