gpt4 book ai didi

java.lang.IllegalStateException : Default FirebaseApp is not initialized in this process com. example.bottomnav

转载 作者:行者123 更新时间:2023-12-04 16:25:51 25 4
gpt4 key购买 nike

我制作了包含 Firebase 身份验证的应用程序的基本版本,在将应用程序与 firebase 连接之前,我在 Android 模拟器中测试了该应用程序。我收到以下错误,然后我自己修复了一些东西。
- 连接火力基地
-添加了依赖 classpath 'com.google.gms:google-services:4.2.0'仍然遇到以下错误-

/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.bottomnav, PID: 2049
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bottomnav/com.example.bottomnav.login}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.bottomnav. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.example.bottomnav. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common@@19.3.0:184)
at com.google.firebase.auth.FirebaseAuth.getInstance(com.google.firebase:firebase-auth@@19.3.1:1)
at com.example.bottomnav.login.onCreate(login.java:40)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
我在早期的项目中使用过 Firebase 工具,我的印象是使用 Android Studio 中的内置 firebase 工具可以自动完成所有工作。那么,有没有我可能跳过的步骤?

最佳答案

对我来说,问题是使用谷歌服务插件版本 4.3.9。只是
改变

        classpath 'com.google.gms:google-services:4.3.9'  
       classpath 'com.google.gms:google-services:4.3.8'  

关于java.lang.IllegalStateException : Default FirebaseApp is not initialized in this process com. example.bottomnav,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64384320/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com