错误:修复版本冲突(google-services插件)

70
根据这个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(Module: 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'


现在需要做出哪些改变?


确保所有的Play服务版本都是相同的。 - sushma1008
14个回答

0

正如消息所说,前往: com.google.gms.google-services versions

并复制最后一个版本的编号。我的版本低于3.3.1。 然后在项目的build.gradle中将依赖项节点放置/更改为:

dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2' // as it was before             
    classpath 'com.google.gms:google-services:3.3.1' // <-- the version change                  
        }

然后我同步了项目,错误消失了


0
所有的谷歌服务应该是同一个版本,尝试匹配每个版本正确的版本为:
  implementation 'com.google.firebase:firebase-auth:11.6.0'
  implementation 'com.google.firebase:firebase-database:11.6.0'

错误的配置是:

 implementation 'com.google.firebase:firebase-auth:11.6.0'
 implementation 'com.google.firebase:firebase-database:11.8.0'

0
After All Working for 6 hours i got the solution...

Simple Just what ever the plugins you defined in the build.gradle file... for ex: google services plugins or firebase plugins or any third party plugins all the **version code** should be same..

Example: In my application i am using following plugins...

    // google services plugins
    implementation 'com.google.android.gms:play-services-analytics:10.0.1'
    implementation 'com.google.android.gms:play-services-gcm:10.0.1'
    implementation 'com.google.android.gms:play-services-base:11.6.1'
    implementation 'com.google.android.gms:play-services-auth-api-phone:11.6.0'

    //firebase plugin
    implementation 'com.google.firebase:firebase-ads:10.0.1'

    //Third Party plugin
    implementation 'com.google.android.gms:play-services-auth:16.0.0'

在上述插件版本代码(例如10.0.1、16.0.0、11.6.1)不同的情况下,我遇到了“修复版本冲突(google-services插件)”问题。
Below for all plugins i have given single version code(11.6.0) and the issue is resovled...

 // google services plugins
    implementation 'com.google.android.gms:play-services-analytics:11.6.0'
    implementation 'com.google.android.gms:play-services-gcm:11.6.0'
    implementation 'com.google.android.gms:play-services-base:11.6.0'
    implementation 'com.google.android.gms:play-services-auth-api-phone:11.6.0'

    //firebase plugin
    implementation 'com.google.firebase:firebase-ads:11.6.0'

    //Third Party plugin
    implementation 'com.google.android.gms:play-services-auth:11.6.0'


**Syn Gradle**...

Go to Build>>Rebuild Projcet...

Sure it will work....@Ambilpura

-2

安装或更新Google Play服务。其次,检查您的'com.google.gms:google-services:3.0.0'版本。如果仍然无法正常工作,请升级到3.1.0版本。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接