【问题标题】:How to fix gradle errors for Flutter android project which uses Firestore and messaging如何修复使用 Firestore 和消息传递的 Flutter android 项目的 gradle 错误
【发布时间】:2019-10-11 00:03:51
【问题描述】:

我创建了一个使用 Firebase 服务(身份验证、Firestore、消息传递)的 Flutter 应用。

iOS 版本一切顺利,但我正在与 Android 版本战斗:

我已经关注了官方setup guide

但无论我在 Gradle 文件中使用什么配置 - 我都会遇到异常。

那里有很多不同配置的帖子 - 它们都不适合我,有些已经过时了。

我的最新配置: 在 android/build.gradle 中:

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

在 android/app/build.gradle:

implementation 'com.google.firebase:firebase-core:16.0.9'

导致以下错误:

> The library com.google.firebase:firebase-iid is being requested by various other libraries at [[18.0.0,18.0.0]], but resolves to 17.1.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

我如何以及在哪里可以找到正确的方法来配置这个 android 应用以使用这些 Google 服务运行?

【问题讨论】:

  • 你应该在问题中添加例外

标签: android gradle flutter google-cloud-firestore messaging


【解决方案1】:

好吧,经过多次尝试和错误,对我来说正确的组合是:

pubspec.yaml

cloud_firestore: ^0.11.0+2
firebase_auth: ^0.11.1
firebase_messaging: ^5.0.1+1

android/build.gradle

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

android/app/build.gradle

implementation 'com.google.firebase:firebase-core:16.0.9'

gradle.properties

android.useAndroidX=true
android.enableJetifier=true

【讨论】:

    猜你喜欢
    • 2021-11-18
    • 1970-01-01
    • 1970-01-01
    • 2022-06-18
    • 1970-01-01
    • 1970-01-01
    • 2019-03-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多