针对Google服务的Android版本冲突 [英] Android Version Conflict for Google Services

查看:339
本文介绍了针对Google服务的Android版本冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为此寻找了很多解决方案,但没有一个适合我的确切案例。我在Gradle Sync上遇到这个错误:


$ b

错误:任务':app:processDebugGoogleServices'执行失败。



< blockquote>

请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息可在 https://bintray.com/android/android-tools/com.google.gms.google-services/ )或将com.google.android.gms的版本更新为11.4.2。

这是在我的build.gradle(app)

 依赖关系{
implementation fileTree(dir:'libs',include:['* .jar'] )
implementationorg.jetbrains.kotlin:kotlin-stdlib-jre7:$ kotlin_version
implementation'com.android.support:appcompat-v7:27.0.2'
implementation'com。 android.support:design:27.0.2'
实现ion'com.google.firebase:firebase-firestore:11.8.0'
implementation'com.google.firebase:firebase-auth:11.8.0'
testImplementation'junit:junit:4.12'
androidTestImplementation'com.android.support.test:runner:1.0.1'
androidTestImplementation'com.android.support.test.espresso:espresso-core:3.0.1'
}

这是在我的项目级别build.gradle

 buildscript {
ext.kotlin_version ='1.2.10'
repositories {
google()
jcenter()
}
依赖关系{
classpath'com.android.tools.build:gradle:3.0.1'
classpathorg.jetbrains.kotlin:kotlin-gradle-plugin:$ kotlin_version
classpath'com.google.gms:google-services:3.1.2'
}
}

allprojects {
repositories {
google()
jcenter()
}
}

任务清理(类型:删除){
删除rootProject.buildDir
}

同样重要:
此行显示一条红线:

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

如果我将鼠标悬停在它上面, / p>


所有gms / firebase库必须使用完全相同的版本规范(混合版本可能会导致运行时崩溃)。发现版本11.8.0,11.4.2。示例包括com.google.android.gms:play-services-auth:11.8.0和com.google.firebase:firebase-analytics:11.4.2


我甚至没有分析依赖性!



我该怎么做?

已经尝试过的解决方案:如果我试图更改我的 com.google.android.gms 版本,它会给我一个皮棉说不要将我的整个播放服务捆绑在依赖关系中。而且它也不会改变我得到的firebase错误。



将firebase更改为11.4.2会导致lint错误。



将google play服务版本更改为3.1.1或更低版本将无效。

没有错,Google服务依赖于firebase。我认为两者都有冲突



请检查此 firebase.google.com/docs/android/setup 并调整Google服务和Firebase依赖项版本



另外,请确保您已将其放置在您的底部 build.gradle(应用程式)档案:



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


I've searched for a lot of solutions to this, but none fit my exact case. I am getting this error on Gradle Sync:

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

this is in my build.gradle (app) dependencies.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

and this is in my Project level build.gradle

buildscript {
    ext.kotlin_version = '1.2.10'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:3.1.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Also Important: It shows a red line under this line:

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

The message I'm getting if I hover over it:

All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 11.8.0, 11.4.2. Examples include com.google.android.gms:play-services-auth:11.8.0 and com.google.firebase:firebase-analytics:11.4.2

I don't even have an analytics dependency!

What do I do?

Already tried solutions:

If I try to change my com.google.android.gms version, it will throw me a lint saying not to bundle my entire play services in the dependencies. And it also doesn't change the firebase error I'm getting.

Changing firebase to 11.4.2 will throw a lint error.

Changing google play services version to 3.1.1 or below will do nothing.

解决方案

If I am not wrong, Google services have the dependency on the firebase. I think both are conflicting

check this firebase.google.com/docs/android/setup and adjust google services and firebase dependency versions

Also, make sure you have this at the bottom of your build.gradle (app) file:

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

这篇关于针对Google服务的Android版本冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆