我在我的 Android 应用程序中实现了 Firebase 提供的电子邮件/密码登录方法。它工作正常。但是今天由于我不知道的某些原因它没有用。我没有更改任何与我的登录 Activity 相关的代码,也没有更改我的 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 服务目前不工作吗?还是我的代码有问题?我完全迷路了。感谢您分享任何想法。
最佳答案
我设法通过创建一个带有 x86_64 SDK 的新模拟器 使其再次运行。我认为这与 this question 有关和 this question
关于android - Firebase 电子邮件/密码身份验证从未完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53915563/