FirebaseAuth.getCurrentUser()
is returning null
value. Previously my code worked fine but since couple of days its returning currentUser
as null
.
Also I've tried my app on another device and in that device everything is working fine with the same code.
mAuth=FirebaseAuth.getInstance();
mCurrentUser=mAuth.getCurrentUser()
mUserDatabase=FirebaseDatabase.getInstance().getReference().child("Users")
.child(mCurrentUser.getUid());
Exception:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.google.firebase.auth.FirebaseUser.getUid()' on a null object reference
I have already tried erasing app data and uninstalling and reinstalling my app on my device but nothing worked.
Is there a problem with my device or Firebase
?