You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用com.google.gms:google-services:4.3.15时应用崩溃,FirebaseApp未初始化问题求助

com.google.gms:google-services:4.3.15时应用崩溃,FirebaseApp未初始化问题求助

各位好,我最近在Android Giraffe环境下开发时遇到了一个头疼的应用崩溃问题,折腾了好一阵都没搞定,来这儿求助大家!

崩溃日志

Problem:
App Crash com.google.gms:google-services:4.3.15

FATAL EXCEPTION: main

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.yyy/com.xxx.yyy.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.xxx.yyy Make sure to call FirebaseApp.initializeApp(Context) first.

我的Gradle配置

项目级build.gradle

buildscript {
    ext.kotlin_version = '1.9.0'
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.0"
        classpath 'com.google.gms:google-services:4.3.15'
    }
}

模块级build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

dependencies {
    implementation platform('com.google.firebase:firebase-bom:26.8.0')
    // 其他Firebase相关依赖这里就不全贴了
}

我按照Firebase文档的步骤加了google-services插件和BOM依赖,但启动应用还是报FirebaseApp未初始化的错误,有没有同学遇到过类似的问题?麻烦帮我看看哪里配置出问题了,万分感谢!

备注:内容来源于stack exchange,提问作者Edward

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 09:44:36