本文介绍了与Firebase 11.8.0和google-services插件3.1.2冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与firebase 11.8.0和google-services插件3.1.2存在明显冲突。构建失败,建议我使用Firebase 11.4.2版本。



我的gradle构建文件的相关摘录:



build.gradle

  buildscript {
存储库{
google()
...
}
依赖关系{
classpath'com.google.gms:google-services:3.1.2'
...
}
}

app build.gradle

  apply plugin:'com.google.gms.google-services'
repositories {
google()
....
}
依赖项{
implementationcom.google.firebase:firebase-core:11.8.0
....
}

我已正确生成firebase应用程序文件:

  ./ app / src / debug / google-services.json 
./app/src/ release / google-services.json

当我用 ./ gradlew cl ean assembleDebug ,构建失败并出现此错误:

 >任务:app:processDebugGoogleServices FAILED 
找到com.google.firebase:firebase-core:11.8.0,但需要11.4.2版本的google-services插件。


失败:构建失败,出现异常。

*出错:
任务':app:processDebugGoogleServices'的执行失败。
>请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息,请访问https://bintray.com/android/android-tools/com.google.gms.google-services/)或将com.google.android.gms的版本更新为11.4.2。


解决方案

解决方案是将此行移至应用程序的底部 build.gradle 文件(它不应该在顶部):

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

这是在文档中指定的:



然后,在你的模块Gradle中文件(通常是app / build.gradle),在文件底部添加
apply插件行以启用Gradle
插件:

  apply plugin:'com.android.application'

android {
// ...
}

依赖关系{
// ...
编译'com.google.firebase:firebase-core:11.8.0'

//获取找不到错误?确保你有
//将Google maven储存库添加到你的根目录build.gradle
}

//在底部添加这个
apply plugin:'com .google.gms.google服务'



I have an apparent conflict with firebase 11.8.0 and google-services plugin 3.1.2. The build fails recommending that I use version 11.4.2 of firebase instead.

Relevant extracts of my gradle build files:

Root build.gradle

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

app build.gradle:

apply plugin: 'com.google.gms.google-services'
repositories {
    google()
    ....
}
dependencies {
    implementation "com.google.firebase:firebase-core:11.8.0"
    ....
}

I've correctly generated the firebase app files:

./app/src/debug/google-services.json
./app/src/release/google-services.json

When I build with ./gradlew clean assembleDebug, the build fails with this error:

> Task :app:processDebugGoogleServices FAILED
Found com.google.firebase:firebase-core:11.8.0, but version 11.4.2 is needed for the google-services plugin.


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 11.4.2.
解决方案

The solution is to move this line to the bottom of the app build.gradle file (it shouldn't be at the top):

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

This is specified in the documentation:

https://firebase.google.com/docs/android/setup

这篇关于与Firebase 11.8.0和google-services插件3.1.2冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 10:27