Flutter 推送通知错误分析:缺少google_app_id

Flutter Push Notifications Error Analytics: Missing google_app_id

提问人:Andrei 提问时间:10/6/2023 更新时间:10/6/2023 访问量:90

问:

我正在尝试在我的 Android 应用程序中实现推送通知。当我发送通知时,我收到以下错误:

D/FLTFireMsgReceiver( 8876): broadcast received for message
E/FA      ( 8876): Missing google_app_id. Firebase Analytics disabled. See ...

控制台如下所示:

https://i.stack.imgur.com/LZkJx.png

我在互联网上找到了多个答案,但我无法弄清楚什么有效。我当前的 build.gradle、应用程序和项目中的机器人 h 如下所示:

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

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

android {
    namespace "hu.android.trainhungary.service"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        multiDexEnabled true
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "hu.android.trainhungary.service"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {    implementation 'androidx.multidex:multidex:2.0.1'
}

项目:

buildscript {
    ext.kotlin_version = '1.9.10'

    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        // START: FlutterFire Configuration
        classpath 'com.google.gms:google-services:4.3.10'
        // END: FlutterFire Configuration
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

我已经通过 Flutterfire CLI 实现了 firebase。我尝试手动添加谷歌提供的步骤来连接应用程序,但我遇到错误并且无法使其工作。 我无法设法实施和放入 Firebase Analytics 中,我不知道为什么。

我试过看这个,这正是我遇到的问题,但我无法工作: Flutter:缺少google_app_id。 Firebase Analytics 已禁用

谢谢你帮助我!!

flutter firebase flutter-dependencies firebase-analytics

评论


答: 暂无答案