缺少 google_app_id。 Firebase 分析已禁用

问题描述 投票:0回答:1

我创建了一个新的 Flutter 项目,并使用

flutterfire configure
创建了 Firebase 应用程序,Analytics 在 iOS 中运行得很好,但 Android 应用程序甚至一次都没有触发分析。已经7天了。最初,我以为事件会延迟,但它根本不起作用。

我还添加了 Crashlytics,但这适用于 Android 和 iOS。

<project>/build.gradle

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // Google services
        classpath 'com.google.gms:google-services:4.4.1'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

...other stuff

<project>/app/build.gradle

plugins {
    id "com.android.application"
    id 'com.google.gms.google-services'
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

...other stuff

至于错误信息,我只是得到

E/FA (15604):缺少 google_app_id。 Firebase 分析已禁用。 参见####

目前已尝试过

  1. 手动添加
    google-services.json
  2. 手动添加
    google_app_id
    strings.xml
  3. 我已在两个
    build.gradle
    文件中手动添加,
    flutterfire configure
    没有在这些文件中添加任何内容
  4. 使用最新版本的
    flutterfire
    =
    0.2.7

任何人都可以帮助我在 flutter 应用程序中添加 Firebase 分析吗?

flutter firebase firebase-analytics
1个回答
0
投票

我最近也遇到了同样的问题。这个问题(至少对我来说)确实来自于 flutterfire 工具的过时版本。因为它不适用于应用插件的新风格。

您可以通过运行来升级它:

dart pub global activate flutterfire_cli 1.0.0  --overwrite

它改变了我的项目的以下部分:

settings.gradle

旧:

...
plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
}
...

新:

...
plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    // START: FlutterFire Configuration
    id "com.google.gms.google-services" version "4.3.15" apply false
    id "com.google.firebase.firebase-perf" version "1.4.1" apply false
    id "com.google.firebase.crashlytics" version "2.8.1" apply false
    // END: FlutterFire Configuration
}
...

以及文件最顶部的

android/app/build.gradle

旧:

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}
...

新:

plugins {
    id "com.android.application"
    // START: FlutterFire Configuration
    id 'com.google.gms.google-services'
    id 'com.google.firebase.firebase-perf'
    id 'com.google.firebase.crashlytics'
    // END: FlutterFire Configuration
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}
...

希望这对您有帮助,并且可以解决问题;)

© www.soinside.com 2019 - 2024. All rights reserved.