简体   繁体   English

Firebase身份验证导致Android致命异常

[英]Firebase Authentication causing Android fatal exception

I just finished integrating Firebase real time data base and Authentication into my Android Studio application. 我刚完成将Firebase实时数据库和身份验证集成到我的Android Studio应用程序中。 It ran successfully two or three times on my Google Nexus 7 genymotion emulator that has google play services on it. 它在装有Google Play服务的Google Nexus 7 genymotion模拟器上成功运行了两三次。 Then I tried launching it again and I started getting the below error: 然后我尝试再次启动它,然后开始出现以下错误:

06-25 16:50:46.994 7699-7699/
com.careersvirtualsolutions.uprate E/AndroidRuntime: 
FATAL EXCEPTION: main
java.lang.NullPointerException
at com.google.firebase.auth.FirebaseAuth$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

I think this has something to do with the Firebase Authentication SDK but I am not sure. 我认为这与Firebase身份验证SDK有关,但我不确定。 Do you know what this is caused by? 你知道这是什么原因吗? How can I solve it? 我该如何解决?

I actually figured it out, the problem was with the AuthStateListener. 我实际上已经弄清楚了,问题出在AuthStateListener上。 So if you're having a similar issue, try testing your project with the AuthStateListener commented out and see if it launches without crashing. 因此,如果您遇到类似的问题,请尝试在注释掉AuthStateListener的情况下测试您的项目,然后查看它是否启动而不会崩溃。 If it does you can then figure out how to replace the existing listener. 如果是这样,则可以找出如何替换现有侦听器的方法。

Hope this helps in some way! 希望这会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM