错误 - 缺少 google_app_id。 Firebase 分析已禁用

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

在我的 Android 应用中启用 Firebase Analytics 时,我收到此错误。并且分析没有显示在仪表板中。

E/FA      ( 7298): Missing google_app_id. Firebase Analytics is disabled.

我对 Firebase 两个项目使用相同的代码库,对 UAT 和 PROD 都使用调味技术。我已经实现了 Crashlytics,它在 iOS 和 Android 上都运行良好。

我尝试了此链接中的解决方案,但它们对我不起作用。Flutter:缺少 google_app_id。 Firebase Analytics 已禁用

  1. app/build.gradle

  2. build.gradle

  3. 文件结构

  4. Firebase 选项 Dart 文件

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

自 Flutter 3.16.4 起,所有新应用程序上的 Gradle 设置默认已更改,导致破坏了 flutter-fire CLI 自动配置。

您必须自己配置Android gradle。

这对我有用。

./android/settings.gradle

plugins {
    id "dev.flutter.flutter-plugin-loader" version "1.0.0"
    id "com.android.application" version "7.3.0" apply false
    id "org.jetbrains.kotlin.android" version "1.9.0" apply false
    id "com.google.gms.google-services" version "4.3.15" apply false
    id "com.google.firebase.crashlytics" version "2.8.1" apply false
    id "com.google.firebase.firebase-perf" version "1.4.2" apply false
}

注意:版本可能已经过时,要么是这篇文章太旧,要么是与其他版本不兼容。例如:firebase-perf (1.4.2) 仅与 google-services:4.3.15 和 kotlin (1.9.0) 兼容

./android/app/build.gradle

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
    id "com.google.gms.google-services"
    id 'com.google.firebase.crashlytics'
    id 'com.google.firebase.firebase-perf'
}
android {
    ...
    compileSdk 34
    ...
    defaultConfig {
      ...
      minSdkVersion 28
      targetSdkVersion 34
      ...
    }
    ...
}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0"
    implementation(platform("com.google.firebase:firebase-bom:32.8.0"))
    implementation("com.google.firebase:firebase-analytics")
    implementation("com.google.firebase:firebase-crashlytics")
    implementation("com.google.firebase:firebase-perf")
}

./android/app/src/main/AndroidManifest.xml

<application>
    ....
    <meta-data
      android:name="firebase_performance_logcat_enabled"
      android:value="true" />
    ....
</application>
© www.soinside.com 2019 - 2024. All rights reserved.