更新gradle依赖关系9.4.0到9.6.1时生成错误

时间:2016-09-26 19:01:41

标签: android gradle google-play-services

大家好,我只是更新我的渐变依赖,但是当我构建我的项目时,它没有建立。

这是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

这是我的应用程序级别构建classl看起来像

.
.
.

    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:3.0.3@aar'
        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:2.6.3@aar') {
            transitive = true;
        }
    }
    apply plugin: 'com.google.gms.google-services'

我所有的谷歌存储库都是最新的。 SDK管理器中没有显示任何更新。

如何解决此问题

感谢。

1 个答案:

答案 0 :(得分: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'
}