版本冲突更新到播放服务9.4.0 Android studio 2.2

时间:2016-08-08 16:16:07

标签: android android-studio gradle google-play-services

我收到错误说

 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 9.0.0.

我尝试查看https://bintray.com/android/android-tools/com.google.gms.google-services/和com.google.gms:google-services:3.0.0似乎是最新的。这是我的项目gradle

dependencies {
            classpath 'com.android.tools.build:gradle:2.1.2'
            classpath 'com.google.gms:google-services:3.0.0'
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }

这就是我的应用程序gradle的样子

buildscript {
        repositories {
            maven { url 'https://maven.fabric.io/public' }
        }

        dependencies {
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }
    apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'
    apply plugin: 'com.google.gms.google-services'

    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }


    android {
        compileSdkVersion 24
        buildToolsVersion "24.0.1"
        useLibrary 'org.apache.http.legacy'

        defaultConfig {
            applicationId "com.myapp.preburn"
            minSdkVersion 10
            targetSdkVersion 24
            versionCode 14
            versionName "2.0.1"
            renderscriptTargetApi 22
            renderscriptSupportModeEnabled true
        }
        buildTypes {
            release {
                lintOptions {
                    disable 'MissingTranslation'
                }
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    android {
        packagingOptions {
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
        }
    }

    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile fileTree(dir: 'libs', include: 'Parse-*.jar')
        compile 'com.parse.bolts:bolts-android:1.2.0'
        compile 'com.android.support:appcompat-v7:24.1.1'
        compile 'com.mcxiaoke.volley:library:1.0.9'
        compile 'com.google.android.gms:play-services-gcm:9.4.0'
        compile 'com.google.android.gms:play-services-location:9.4.0'
        compile 'com.google.android.gms:play-services-maps:9.4.0'
        compile 'com.google.android.gms:play-services-ads:9.4.0'
        compile 'com.google.android.gms:play-services-plus:9.4.0'
        compile 'com.google.android.gms:play-services-analytics:9.4.0'
        compile 'me.leolin:ShortcutBadger:1.1.3@aar'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile files('libs/jsoup-1.7.3.jar')
        compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
            transitive = true;
        }
        compile files('libs/InMobi-5.2.2.jar')
        compile files('libs/libadapterinmobi.jar')
        compile files('libs/StartAppAdMobMediation-1.0.1.jar')
        compile files('libs/StartAppInApp-3.3.1.jar')
        compile 'org.adw.library:discrete-seekbar:1.0.1'
        compile 'com.pnikosis:materialish-progress:1.0'
    }

如果我将播放服务更改为9.0.0,一切都编译好了。我在这里缺少什么?

10 个答案:

答案 0 :(得分:149)

您需要将apply plugin: 'com.google.gms.google-services'行放在dependencies块下方 - 这样插件就可以确定您正在使用的Play服务版本。

答案 1 :(得分:62)

如果您有firebase依赖项。更新其版本以匹配Google服务版本: 例如:

 //Firebase Crashreports
 compile 'com.google.firebase:firebase-crash:9.6.1'
//Firebase Analytics
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.android.gms:play-services-analytics:9.6.1'
compile 'com.google.android.gms:play-services-gcm:9.6.1'

所有必须具有相同的9.6.1版本

答案 2 :(得分:3)

在依赖项之后写这个

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

答案 3 :(得分:1)

你有线

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

你build.gradle文件的最后一行?

此错误主要发生在" apply plugin"放在最上面。

答案 4 :(得分:1)

我遇到了同样的问题。

我的解决方案不是在代码中添加任何东西而是下载 Google Support Repository - 您可以在工具中找到它 -> Android -> SDK Manager -> SDK Tools

答案 5 :(得分:1)

只需在依赖项下方应用Google服务即可。 为我工作。

答案 6 :(得分:1)

我遇到了类似的问题。在添加插件的顶部,它对我来说不起作用。所以在gradle底部添加插件。 这解决了我的冲突问题版本

"endpoint:SIP/703"

并添加依赖这些行

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

答案 7 :(得分:0)

我安装了Google Repository:

Android> SDK Manager。 更新Android Studio SDK Manager:单击SDK Tools,展开Support Repository,选择Google Repository,然后单击OK。

答案 8 :(得分:-1)

转到/ platforms / android / cordova-plugin-fcm / * - FCMPlugin.gradle

找到

classpath 'com.google.gms:google-services:+'

替换为

classpath 'com.google.gms:google-services:3.0.0'

再次建造。

答案 9 :(得分:-1)

这个问题实际上耗费了我很多时间,但是我通过应用插件com.google.gms.google-services解决了这个问题。

重要提示:请确保不要在gradle文件的顶部使用它,并在依赖块之后使用它。

相关问题