版本冲突更新到8.4.0

时间:2021-04-24 18:58:40

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 here) or updating the version of com.google.android.gms to 8.3.0.

任务执行失败:app: processggoogleservices。请通过更新google-services插件的版本(有关最新版本的信息可以在这里找到)或更新com.google.android的版本来解决版本冲突。gms 8.3.0。

I've done all the things I've found.

我做了所有我发现的事情。

  dependencies {
            // This does not break the build when Android Studio is missing the JRebel for Android plugin.
            classpath 'com.zeroturnaround.jrebel.android:jr-android-gradle:1.0.+'
            classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
            classpath 'com.google.gms:google-services:2.0.0-alpha3'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }

And in the app gradle

在应用程序中

    compile 'com.google.android.gms:play-services:8.4.0'

14 个解决方案

#1


335  

Use these dependencies for the project build.gradle

将这些依赖项用于项目build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
    classpath 'com.google.gms:google-services:2.0.0-alpha3'
}

and put this at the end of the app-level build.gradle file (after the dependencies).

并将其放在应用程序级构建的末尾。渐变文件(在依赖项之后)。

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

I have no clue why putting this at the end (and not at the beginning ) solves the error.

我不知道为什么把这个放在末尾(而不是开头)会解决这个错误。

EDIT 5/1/2016

编辑5/1/2016

Ok… So trying to put an end to all problems you guys have faced with my solution

好吧,所以试着结束你们在我的解决方案中遇到的所有问题

This is my final app level gradle

这是我最后的应用程序等级

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "your-app-name"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    jcenter()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.android.support:design:23.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.6@aar'
}

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

and this is my final project level gradle

这是我的期末项目等级

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
        classpath 'com.google.gms:google-services:2.0.0-alpha3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Compare this with your own gradle files, and add or modify any values which are different from what I've written.

将它与您自己的gradle文件进行比较,并添加或修改与我所编写的不同的值。

#2


63  

In the application's module (build.gradle)

在应用程序的模块中(build.gradle)

Moving :

移动:

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

to the last line solved the issue.

最后一行解决了问题。

#3


14  

Do the following:

执行以下操作:

  1. Put the following in your build.gradle(Application level gradle file)

    在构建中加入以下内容。gradle(应用程序级别gradle文件)

    dependencies {
          classpath 'com.android.tools.build:gradle:2.0.0-beta2'
          classpath 'com.google.gms:google-services:2.0.0-beta2'
    }
    

Please check here for latest version as this keep on changing.

请在这里查看最新版本,因为这一直在变化。

  1. If you get the below error message than you need to upgrade your gradle wrapper to latest in gradle-wrapper.properties. I'm using 2.10.
  2. 如果您得到下面的错误消息,那么您就需要将gradle包装器升级到最新的level -wrap .properties。我用的是2.10。

Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable

插件太老了,请更新到最近的版本,或者设置ANDROID_DAILY_OVERRIDE环境变量

  1. Put the following line at the bottom of your build.gradle(module level gradle file)

    将以下一行放在构建的底部。gradle(模块级gradle文件)

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

#4


7  

This seems to be fixed with version 3.0.0 of Google Services plugin (and version 9.0.0 of the Google Play Services library). So with this

这似乎是通过谷歌服务插件的3.0.0版本(以及谷歌Play服务库的9.0.0版本)修复的。所以用这个

top level build.gradle

*build.gradle

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

app level build.gradle

应用程序级别build.gradle

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

dependencies {
    compile 'com.google.android.gms:play-services:9.0.0
}

Quick Side Note: If you are updating to version 3.0.0 of the google-services plugin, make sure to regenerate your configuration file as it has new fields (explained here).

附加说明:如果要更新到google-services插件的3.0.0版本,请确保重新生成配置文件,因为它有新的字段(这里解释)。

Edit (2016-06-20): While this does compile and run, I just noticed that in the build logs it does specify to put the plugin at the bottom of the file, or the default (9.0.0) will be used. So in the situation above this isn't a problem since I am using version 9.0.0, but this can be problematic when updating the dependency. Here's the log:

编辑(2016-06-20):虽然它确实进行了编译和运行,但我注意到,在构建日志中,它确实指定将插件放在文件的底部,否则将使用默认的(9.0.0)。因此在上面的情况下,这不是问题,因为我使用的是9.0版本,但是在更新依赖项时,这可能会有问题。日志:

google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used. please apply google-services plugin at the bottom of the build file.

google-services插件无法检测com.google.android的任何版本。gms或com.google。将使用firebase默认版本:9.0.0。请在构建文件的底部应用google-services插件。

#5


5  

For me works only this:

对我来说,只有这样:

Top level.

最高水平。

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
    classpath 'com.google.gms:google-services:3.0.0'
}

App level:

应用水平:

dependencies {
    compile 'com.google.android.gms:play-services-gcm:9.0.1'
    compile 'com.google.android.gms:play-services-location:9.0.1'
}

// should be at the bottom
apply plugin: 'com.google.gms.google-services'

#6


4  

found in official example

发现在官方的例子

in project gradle

在项目gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
        classpath 'com.google.gms:google-services:2.0.0-alpha9'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

in app gradle

在应用它

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.google.samples.quickstart.signin"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'LICENSE.txt'
    }

    // Resolve dependency differences between app and tests
    configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:23.1.1'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'

    // Dependency for Google Sign-In
    compile 'com.google.android.gms:play-services-auth:8.4.0'

    // UiAutomatorTesting
    androidTestCompile 'com.android.support.test:runner:0.4.1'
    androidTestCompile 'com.android.support.test:rules:0.4.1'
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
    androidTestCompile 'com.android.support:support-annotations:23.1.1'
}

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

#7


2  

I have updated in app build.gradle

我更新了app build.gradle

dependencies {
....
compile 'com.google.android.gms:play-services-auth:9.0.0'

and app build.gradle

和应用build.gradle

  dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
    classpath 'com.google.gms:google-services:3.0.0'
}

Its working for.

它的工作。

#8


2  

In my caseI have removed the "apply plugin: 'com.google.gms.google-services'" from the end of the gradle.build and its working fine.

在我的caseI中删除了“应用插件:com.google.gms”。“谷歌服务”的结尾。构建和工作良好。

#9


1  

The important thing is to set Gradle to Version 2.10

重要的是将Gradle设置为2.10版本

https://*.com/a/35188079/570168

https://*.com/a/35188079/570168

#10


1  

I Was serching... at the Google page there is the solution...https://developers.google.com/android/guides/google-services-plugin#introduction

我是serching……在谷歌页面有一个解决方案…https://developers.google.com/android/guides/google-services-plugin#introduction

Add dependencies for basic libraries required for the services you have enabled. This step requires that the apply plugin: 'com.google.gms.google-services' line be at the end of your app/build.gradle file so that no dependency collisions are introduced. You can see the result of this step by running ./gradlew :app:dependencies.

为已启用的服务添加基本库所需的依赖项。这一步需要应用插件:com.google.gms。google-services的服务在你的应用/构建的末尾。渐变文件,这样就不会引入依赖冲突。你可以通过运行来看到这个步骤的结果。/gradlew:app:依赖性。

#11


1  

There is no meaning in moving apply plugin: 'com.google.gms.google-services' to the end of build.gradle. It is same as not defining it.

移动应用插件没有任何意义:com.google.gms。谷歌服务,到建筑的尽头。这和没有定义是一样的。

Just remove this line and make sure apply plugin: 'com.android.application' is there

只要删除这一行,确保应用插件:com.android。应用程序的有

Use:

使用:

compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'

it will compile.

它将编译。

#12


0  

In project gradle

在项目gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:2.0.0-alpha6'
    }
}

in app/module gradle

它在应用程序/模块

apply plugin: 'com.google.gms.google-services'
android {
    ...
}

dependencies {
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
}

#13


-1  

In project gradle:

在项目gradle:

       compileSdkVersion 23

It is working.

它是有效的。

#14


-3  

Here is my instruction to fix it.

这是我的说明。

  1. Change to use compile 'com.google.android.gms:play-services-location:8.3.0' in app build.gradle
  2. 更改为在app build.gradle中使用compile 'com.google.android.gms:play-services-location:8.3.0'
  3. Move apply plugin: 'com.google.gms.google-services' to the end of app build.gradle
  4. 移动应用插件:“com.google.gms。“谷歌服务”,直到应用程序构建完毕
  5. Use classpath 'com.google.gms:google-services:2.0.0-alpha3' in project build.gradle dependency
  6. 在项目构建中使用类路径'com.google.gms:google-services:2.0 -alpha3'。gradle依赖
  7. Change to use gradle-2.8 in gradle/wrapper/gradle-wrapper.properties
  8. 更改为在gradle/wrapper/gradle .properties中使用第2.8级

#1


335  

Use these dependencies for the project build.gradle

将这些依赖项用于项目build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
    classpath 'com.google.gms:google-services:2.0.0-alpha3'
}

and put this at the end of the app-level build.gradle file (after the dependencies).

并将其放在应用程序级构建的末尾。渐变文件(在依赖项之后)。

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

I have no clue why putting this at the end (and not at the beginning ) solves the error.

我不知道为什么把这个放在末尾(而不是开头)会解决这个错误。

EDIT 5/1/2016

编辑5/1/2016

Ok… So trying to put an end to all problems you guys have faced with my solution

好吧,所以试着结束你们在我的解决方案中遇到的所有问题

This is my final app level gradle

这是我最后的应用程序等级

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "your-app-name"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    jcenter()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.android.support:design:23.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.6@aar'
}

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

and this is my final project level gradle

这是我的期末项目等级

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
        classpath 'com.google.gms:google-services:2.0.0-alpha3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Compare this with your own gradle files, and add or modify any values which are different from what I've written.

将它与您自己的gradle文件进行比较,并添加或修改与我所编写的不同的值。

#2


63  

In the application's module (build.gradle)

在应用程序的模块中(build.gradle)

Moving :

移动:

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

to the last line solved the issue.

最后一行解决了问题。

#3


14  

Do the following:

执行以下操作:

  1. Put the following in your build.gradle(Application level gradle file)

    在构建中加入以下内容。gradle(应用程序级别gradle文件)

    dependencies {
          classpath 'com.android.tools.build:gradle:2.0.0-beta2'
          classpath 'com.google.gms:google-services:2.0.0-beta2'
    }
    

Please check here for latest version as this keep on changing.

请在这里查看最新版本,因为这一直在变化。

  1. If you get the below error message than you need to upgrade your gradle wrapper to latest in gradle-wrapper.properties. I'm using 2.10.
  2. 如果您得到下面的错误消息,那么您就需要将gradle包装器升级到最新的level -wrap .properties。我用的是2.10。

Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable

插件太老了,请更新到最近的版本,或者设置ANDROID_DAILY_OVERRIDE环境变量

  1. Put the following line at the bottom of your build.gradle(module level gradle file)

    将以下一行放在构建的底部。gradle(模块级gradle文件)

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

#4


7  

This seems to be fixed with version 3.0.0 of Google Services plugin (and version 9.0.0 of the Google Play Services library). So with this

这似乎是通过谷歌服务插件的3.0.0版本(以及谷歌Play服务库的9.0.0版本)修复的。所以用这个

top level build.gradle

*build.gradle

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

app level build.gradle

应用程序级别build.gradle

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

dependencies {
    compile 'com.google.android.gms:play-services:9.0.0
}

Quick Side Note: If you are updating to version 3.0.0 of the google-services plugin, make sure to regenerate your configuration file as it has new fields (explained here).

附加说明:如果要更新到google-services插件的3.0.0版本,请确保重新生成配置文件,因为它有新的字段(这里解释)。

Edit (2016-06-20): While this does compile and run, I just noticed that in the build logs it does specify to put the plugin at the bottom of the file, or the default (9.0.0) will be used. So in the situation above this isn't a problem since I am using version 9.0.0, but this can be problematic when updating the dependency. Here's the log:

编辑(2016-06-20):虽然它确实进行了编译和运行,但我注意到,在构建日志中,它确实指定将插件放在文件的底部,否则将使用默认的(9.0.0)。因此在上面的情况下,这不是问题,因为我使用的是9.0版本,但是在更新依赖项时,这可能会有问题。日志:

google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default version: 9.0.0 will be used. please apply google-services plugin at the bottom of the build file.

google-services插件无法检测com.google.android的任何版本。gms或com.google。将使用firebase默认版本:9.0.0。请在构建文件的底部应用google-services插件。

#5


5  

For me works only this:

对我来说,只有这样:

Top level.

最高水平。

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
    classpath 'com.google.gms:google-services:3.0.0'
}

App level:

应用水平:

dependencies {
    compile 'com.google.android.gms:play-services-gcm:9.0.1'
    compile 'com.google.android.gms:play-services-location:9.0.1'
}

// should be at the bottom
apply plugin: 'com.google.gms.google-services'

#6


4  

found in official example

发现在官方的例子

in project gradle

在项目gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
        classpath 'com.google.gms:google-services:2.0.0-alpha9'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

in app gradle

在应用它

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.google.samples.quickstart.signin"
        minSdkVersion 18
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'LICENSE.txt'
    }

    // Resolve dependency differences between app and tests
    configurations.all {
        resolutionStrategy.force 'com.android.support:support-annotations:23.1.1'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'

    // Dependency for Google Sign-In
    compile 'com.google.android.gms:play-services-auth:8.4.0'

    // UiAutomatorTesting
    androidTestCompile 'com.android.support.test:runner:0.4.1'
    androidTestCompile 'com.android.support.test:rules:0.4.1'
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
    androidTestCompile 'com.android.support:support-annotations:23.1.1'
}

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

#7


2  

I have updated in app build.gradle

我更新了app build.gradle

dependencies {
....
compile 'com.google.android.gms:play-services-auth:9.0.0'

and app build.gradle

和应用build.gradle

  dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
    classpath 'com.google.gms:google-services:3.0.0'
}

Its working for.

它的工作。

#8


2  

In my caseI have removed the "apply plugin: 'com.google.gms.google-services'" from the end of the gradle.build and its working fine.

在我的caseI中删除了“应用插件:com.google.gms”。“谷歌服务”的结尾。构建和工作良好。

#9


1  

The important thing is to set Gradle to Version 2.10

重要的是将Gradle设置为2.10版本

https://*.com/a/35188079/570168

https://*.com/a/35188079/570168

#10


1  

I Was serching... at the Google page there is the solution...https://developers.google.com/android/guides/google-services-plugin#introduction

我是serching……在谷歌页面有一个解决方案…https://developers.google.com/android/guides/google-services-plugin#introduction

Add dependencies for basic libraries required for the services you have enabled. This step requires that the apply plugin: 'com.google.gms.google-services' line be at the end of your app/build.gradle file so that no dependency collisions are introduced. You can see the result of this step by running ./gradlew :app:dependencies.

为已启用的服务添加基本库所需的依赖项。这一步需要应用插件:com.google.gms。google-services的服务在你的应用/构建的末尾。渐变文件,这样就不会引入依赖冲突。你可以通过运行来看到这个步骤的结果。/gradlew:app:依赖性。

#11


1  

There is no meaning in moving apply plugin: 'com.google.gms.google-services' to the end of build.gradle. It is same as not defining it.

移动应用插件没有任何意义:com.google.gms。谷歌服务,到建筑的尽头。这和没有定义是一样的。

Just remove this line and make sure apply plugin: 'com.android.application' is there

只要删除这一行,确保应用插件:com.android。应用程序的有

Use:

使用:

compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'

it will compile.

它将编译。

#12


0  

In project gradle

在项目gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:2.0.0-alpha6'
    }
}

in app/module gradle

它在应用程序/模块

apply plugin: 'com.google.gms.google-services'
android {
    ...
}

dependencies {
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
}

#13


-1  

In project gradle:

在项目gradle:

       compileSdkVersion 23

It is working.

它是有效的。

#14


-3  

Here is my instruction to fix it.

这是我的说明。

  1. Change to use compile 'com.google.android.gms:play-services-location:8.3.0' in app build.gradle
  2. 更改为在app build.gradle中使用compile 'com.google.android.gms:play-services-location:8.3.0'
  3. Move apply plugin: 'com.google.gms.google-services' to the end of app build.gradle
  4. 移动应用插件:“com.google.gms。“谷歌服务”,直到应用程序构建完毕
  5. Use classpath 'com.google.gms:google-services:2.0.0-alpha3' in project build.gradle dependency
  6. 在项目构建中使用类路径'com.google.gms:google-services:2.0 -alpha3'。gradle依赖
  7. Change to use gradle-2.8 in gradle/wrapper/gradle-wrapper.properties
  8. 更改为在gradle/wrapper/gradle .properties中使用第2.8级