用户更新到Android Studio后无法登录

时间:2019-11-15 04:32:36

标签: android firebase firebase-authentication

我正在使用以下代码登录我的android应用程序,但是在android studio更新后,它无法正常工作,也没有导致成功登录的活动集,因此我更新了的所有依赖项以及火力基地。注册活动也发生了类似的事情

mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if(task.isSuccessful()){
                        FirebaseUser user = mAuth.getCurrentUser();
                       // final String userId = user.getUid();
                        emailaddressChecker = user.isEmailVerified();
                        if(emailaddressChecker){
                            mAuth.getCurrentUser().getIdToken(true).addOnSuccessListener(new OnSuccessListener<GetTokenResult>() {
                                @Override
                                public void onSuccess(GetTokenResult getTokenResult) {
                                    String tokenId1 = getTokenResult.getToken();
                                    String current_id = mAuth.getUid();
                                    Map tokenUpdate = new HashMap<>();
                                    tokenUpdate.put("tokenId", tokenId1);
                                    Log.d(TAG,  "  hello  " );



                                   db.collection("users").document(current_id).update(tokenUpdate).addOnSuccessListener(new OnSuccessListener<Void>() {
                                        @Override
                                        public void onSuccess(Void aVoid) {

                                            SendUserToMainActivity();
                                            //progressbar invisible;

                                        }
                                    }).addOnFailureListener(new OnFailureListener() {
                                        @Override
                                        public void onFailure(@NonNull Exception e) {
                                            mAuth.signOut();
                                        }
                                    });


                                }
                            });

                           // SendUserToMainActivity();
                            loadingbar.dismiss();


                        }else {
                            Toast.makeText(SignInActivity.this, "Please Verify Your Email. Check Your Inbox.", Toast.LENGTH_SHORT).show();
                           // Toast.makeText(this, "", Toast.LENGTH_SHORT).show();
                            user.sendEmailVerification();
                            mAuth.signOut();
                            loadingbar.dismiss();
                        }

                        //Toast.makeText(SignInActivity.this, "Your Are logged in Successfully", Toast.LENGTH_SHORT).show();
//
                    }
                    else{
                        String message = task.getException().getMessage();
                        Toast.makeText(SignInActivity.this, "Error occured"+message, Toast.LENGTH_SHORT).show();

                        loadingbar.dismiss();
                    }
                }
            });

logcat详细信息

2019-11-15 09:55:20.509 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 D/InputTransport: Input channel destroyed: fd=79
2019-11-15 09:55:20.520 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 D/ViewRootImpl@5313121[SignInActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
2019-11-15 09:55:20.521 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 D/InputMethodManager: prepareNavigationBarInfo() DecorView@19549b0[SignInActivity]
2019-11-15 09:55:20.521 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 D/InputMethodManager: getNavigationBarColor() -855310
2019-11-15 09:55:20.557 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 E/ViewRootImpl: sendUserActionEvent() returned.
2019-11-15 09:55:21.124 9452-9536/com.ramneekkashyap.blogapplication.blogapp2 D/FirebaseAuth: Notifying id token listeners about user ( 18EM7y8fKlYOKQZJNo32Bm7vvvF2 ).
2019-11-15 09:55:21.139 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 D/DocSnippets:   hello  
2019-11-15 09:55:21.331 9452-9609/com.ramneekkashyap.blogapplication.blogapp2 D/ConnectivityManager: requestNetwork; CallingUid : 10461, CallingPid : 9452
2019-11-15 09:55:21.337 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 W/DynamiteModule: Local module descriptor class for providerinstaller not found.
2019-11-15 09:55:21.363 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 I/DynamiteModule: Considering local module providerinstaller:0 and remote module providerinstaller:0
2019-11-15 09:55:21.364 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 W/ProviderInstaller: Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
2019-11-15 09:55:21.395 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 I/cation.blogapp: The ClassLoaderContext is a special shared library.
2019-11-15 09:55:21.401 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 I/cation.blogapp: The ClassLoaderContext is a special shared library.
2019-11-15 09:55:21.407 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 I/cation.blogapp: The ClassLoaderContext is a special shared library.
2019-11-15 09:55:21.453 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 286 native methods...
2019-11-15 09:55:21.508 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (light greylist, reflection)
2019-11-15 09:55:21.523 9452-9609/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection)
2019-11-15 09:55:21.739 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2019-11-15 09:55:21.743 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
2019-11-15 09:55:21.951 9452-9611/com.ramneekkashyap.blogapplication.blogapp2 D/ConnectivityManager: requestNetwork; CallingUid : 10461, CallingPid : 9452
2019-11-15 09:55:22.302 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 D/NetworkManagementSocketTagger: tagSocket(79) with statsTag=0xffffffff, statsUid=-1
2019-11-15 09:55:22.361 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden field Ljava/net/Socket;->impl:Ljava/net/SocketImpl; (light greylist, reflection)
2019-11-15 09:55:22.364 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (light greylist, linking)
2019-11-15 09:55:22.375 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (light greylist, linking)
2019-11-15 09:55:22.385 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (light greylist, JNI)
2019-11-15 09:55:22.625 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden method Ljava/security/spec/ECParameterSpec;->setCurveName(Ljava/lang/String;)V (light greylist, reflection)
2019-11-15 09:55:22.773 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden method Ldalvik/system/BlockGuard;->getThreadPolicy()Ldalvik/system/BlockGuard$Policy; (light greylist, linking)
2019-11-15 09:55:22.773 9452-9616/com.ramneekkashyap.blogapplication.blogapp2 W/cation.blogapp: Accessing hidden method Ldalvik/system/BlockGuard$Policy;->onNetwork()V (light greylist, linking)
2019-11-15 09:55:25.900 9452-9609/com.ramneekkashyap.blogapplication.blogapp2 W/Firestore: (21.3.0) [Firestore]: Write failed at users/18EM7y8fKlYOKQZJNo32Bm7vvvF2: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}
2019-11-15 09:55:25.907 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 D/FirebaseAuth: Notifying id token listeners about a sign-out event.
2019-11-15 09:55:25.907 9452-9452/com.ramneekkashyap.blogapplication.blogapp2 D/FirebaseAuth: Notifying auth state listeners about a sign-out event.

2 个答案:

答案 0 :(得分:0)

我认为这是因为您的设备或仿真器都具有Google Play services的过时版本。 只需更新Google Play服务即可使用。

答案 1 :(得分:0)

您没有适当的权限。在Firebase控制台中检查“电子邮件”权限。