我更新了com.google.firebase:firebase-core:16.0.7
,com.google.firebase:firebase-auth:16.1.0
但我的代码中没有更改任何内容,现在FirebaseAuth.getInstance()
为null。
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.auth.FirebaseUser com.google.firebase.auth.FirebaseAuth.getCurrentUser()' on a null object reference
我想检查用户是否已登录
FirebaseAuth.getInstance().getCurrentUser()
我在gradle sync时遇到这些错误(但它已成功完成):
我发现了这个错误的原因。tools:node="replace"
由于依赖性,我添加到了我的AndroidManifest.xml。当我删除它一切都工作正常。
I updated com.google.firebase:firebase-core:16.0.7
and com.google.firebase:firebase-auth:16.1.0
but I didn't changed anything in my code and now FirebaseAuth.getInstance()
is null.
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.auth.FirebaseUser com.google.firebase.auth.FirebaseAuth.getCurrentUser()' on a null object reference
I want to check if the user is signed in or not with
FirebaseAuth.getInstance().getCurrentUser()
And I get these errors while gradle sync(but it was completed successfully):
I found out the reason for this error. I added tools:node="replace"
to my AndroidManifest.xml because of a dependency. As I removed it all worked fine again.