热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

关于android:与firebase11.8.0和googleservices插件3.1.2冲突

Conflictwithfirebase11.8.0andgoogle-servicesplugin3.1.2


Conflict with firebase 11.8.0 and google-services plugin 3.1.2


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

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

根 build.gradle










1
2
3
4
5
6
7
8
9
10


buildscript {

    repositories {

        google()

        ...

    }

    dependencies {

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

        ...

    }

}


应用程序 build.gradle:










1
2
3
4
5
6
7
8
9


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

repositories {

    google()

    ....

}

dependencies {

    implementation"com.google.firebase:firebase-core:11.8.0"

    ....

}


我已经正确生成了 firebase 应用文件:










1
2


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

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


当我使用 ./gradlew clean assembleDebug 构建时,构建失败并出现以下错误:










1
2
3
4
5
6
7
8
9


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





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










1


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


这是在文档中指定的:

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

Then, in your module Gradle file (usually the app/build.gradle), add

the apply plugin line at the bottom of the file to enable the Gradle

plugin:










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16


apply plugin: 'com.android.application'

android {

  // ...

}

dependencies {

  // ...

  compile 'com.google.firebase:firebase-core:11.8.0'

  // Getting a"Could not find" error? Make sure you have

  // added the Google maven respository to your root build.gradle

}

// ADD THIS AT THE BOTTOM

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










推荐阅读
author-avatar
CoCo培培_409
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有