首页 > 解决方案 > Firebase 电子邮件/密码身份验证从未完成

问题描述

我在我的 Android 应用程序中实现了 Firebase 提供的电子邮件/密码登录方法。它工作正常。但是今天由于某些我不知道的原因它没有工作。我没有更改与我的登录活动相关的任何代码,也没有更改我的 Firebase 控制台中的设置。

在此处输入图像描述

private void signIn(String email, String password) {
    Log.d(TAG, "signIn:" + email);
    if (!validateForm()) {
        return;
    }

    showProgressDialog();

    // [START sign_in_with_email]
    firebaseAuth.signInWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, task -> {
                if (task.isSuccessful()) {
                    // Sign in success, update UI with the signed-in user's information
                    Log.d(TAG, "signInWithEmail:success");
                    FirebaseUser user = firebaseAuth.getCurrentUser();
                    updateUI(user);
                } else {
                    // If sign in fails, display a message to the user.
                    Log.w(TAG, "signInWithEmail:failure", task.getException());
                    Toast.makeText(LoginActivity.this, "Authentication failed.",
                            Toast.LENGTH_SHORT).show();
                }

                hideProgressDialog();
            });
    // [END sign_in_with_email]
}

在 Logcat 中,它显示程序确实到达了登录方法,但不知何故,身份验证过程从未完成(日志从未显示 signInWithEmail:success 或 signInWithEmail:failure)。

在此处输入图像描述

我确实尝试了其他解决方案,例如将 addOnCompleteListener 更改为 addOnSuccessListener 但没有任何改变。Firebase 服务目前无法正常工作吗?还是我的代码有问题?我完全迷路了。我很感激你想分享的任何想法。

标签: androidfirebasefirebase-authentication

解决方案


通过使用 x86_64 SDK 创建一个新的模拟器,我设法让它再次工作。我认为这与这个问题这个问题有关


推荐阅读