Firebase .getUID NullPointerException when authen

后端 未结 3 1692
甜味超标
甜味超标 2021-02-10 06:21

I will add data to database when I register, but I got

Java.lang.NullPointerException: Attempt to invoke virtual method \'java.lang.String com.google.firebase.auth.

3条回答
  •  南旧
    南旧 (楼主)
    2021-02-10 06:36

    What is the type of auth you have mentioned in the code, Replace it with single line and check if it works

            String mUid = FirebaseAuth.getInstance().getCurrentUser().getUid();
    

    You may also check the documentation for full working code example: https://firebase.google.com/docs/auth/android/manage-users

提交回复
热议问题