2016-09-26 37 views
2

你好傢伙我只是更新我的gradale依賴關係,但是當我構建我的項目時,它不會構建。當更新gradle dependency 9.4.0到9.6.1時生成錯誤

這裏是GRANDEL控制檯erroe代碼

 
:app:processDebugGoogleServices 
Found com.google.android.gms:play-services-ads:9.6.1, but version 9.4.0 is needed for the google-services plugin. 
Found com.google.android.gms:play-services:9.6.1, but version 9.4.0 is needed for the google-services plugin. 
Found com.google.android.gms:play-services-gcm:9.6.1, but version 9.4.0 is needed for the google-services plugin. 
Found com.google.android.gms:play-services-analytics:9.6.1, but version 9.4.0 is needed for the google-services plugin. 
Found com.google.android.gms:play-services-location:9.6.1, but version 9.4.0 is needed for the google-services plugin. 
:app:processDebugGoogleServices FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
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 9.4.0. 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

這裏是我的應用程序級的構建格拉德爾樣子

 
. 
. 
. 

    dependencies { 
     compile fileTree(include: ['*.jar'], dir: 'libs') 
     testCompile 'junit:junit:4.12' 
     compile 'com.android.support:appcompat-v7:24.2.1' 
     compile files('libs/commons-codec-1.10.jar') 
     compile 'com.onesignal:OneSignal:[email protected]' 
     compile 'com.google.firebase:firebase-ads:9.4.0' 
     compile 'com.google.firebase:firebase-database:9.4.0' 
     compile 'com.google.android.gms:play-services-ads:9.6.1' 
     compile 'com.google.android.gms:play-services:9.6.1' 
     compile 'com.google.android.gms:play-services-gcm:9.6.1' 
     compile 'com.google.android.gms:play-services-analytics:9.6.1' 
     compile 'com.google.android.gms:play-services-location:9.6.1' 
     compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
      transitive = true; 
     } 
    } 
    apply plugin: 'com.google.gms.google-services' 

我所有的谷歌資料庫是最新的。 沒有顯示在SDK管理器中更新。

如何解決此問題

謝謝。

+1

停止混合不同版本的Firebase和Google Play服務。 –

+0

您的錯誤提到您需要[Google服務插件]的最新版本(https://developers.google.com/android/guides/google-services-plugin) –

回答

4

您正在混合不同版本的Firebase和Google Play服務。別。

ext.googlePlayVersion = "9.6.1" 
compile "com.google.firebase:firebase-ads:$googlePlayVersion" 
compile "com.google.firebase:firebase-database:$googlePlayVersion" 
compile "com.google.android.gms:play-services-ads:$googlePlayVersion" 
compile "com.google.android.gms:play-services:$googlePlayVersion" 
compile "com.google.android.gms:play-services-gcm:$googlePlayVersion" 
compile "com.google.android.gms:play-services-analytics:$googlePlayVersion" 
compile "com.google.android.gms:play-services-location:$googlePlayVersion" 

注意:雙引號是強制性的,否則變量將被逐字地採取。


請確保您使用的是最新的Google服務插件,截至9月26日爲3.0.0。檢查您的項目build.gradle

dependencies { 
    classpath 'com.google.gms:google-services:3.0.0' 
} 
+0

hello它的工作原理,firebase剛在此處更新了他們的文檔https: //firebase.google.com/docs/database/android/start/在9.4版現在9.6.0版之前的一段時間,感謝您的解決方案 –

相關問題