Android - Firebase 快速入门电子邮件/密码验证演示不起作用 [英] Android - Firebase Quickstart Email/Password Auth demo doesn't work

查看:28
本文介绍了Android - Firebase 快速入门电子邮件/密码验证演示不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,这里有几个类似的问题,但没有一个对我有用.

So, there are a couple similar questions on here, but none of them have a working solution for me.

我正在使用从 Github 下载的快速入门演示.今天下载了.我没有更改演示代码中的任何内容.

I am using the Quickstart demo downloaded from Github. Downloaded today. I've changed nothing in the demo code.

我已解决的一些常见错误(根据我阅读的内容):

Some common mistakes (from what I've read) that I've addressed:

  • 我在 Firebase 控制台中创建了项目可下载的 json 文件(使用包名创建).我已经提供我的 SHA1 指纹.

  • I have the project created in the Firebase Console with the downloadable json file (created with package name). I have provided my SHA1 fingerprint.

电子邮件/密码登录方法已选中.

Email/Password sign-in method is checked.

我更新并安装了 Google Play 服务和 Google 存储库(来自 AndroidStudio SDK 管理器)

I have Google Play Services and Google Repository updated and installed (from the Android Studio SDK manager)

在我的设备上,Google Play 服务版本为 9.4.52

On my device Google Play Services is version 9.4.52

如果我在 Firebase 控制台中打开匿名登录选项,我就可以成功匿名登录演示应用程序.但电子邮件/密码将不起作用.

If I turn on the Anonymous sign-in option in the Firebase Console, I'm able to successfully Anonymously sign in on the demo app. But Email/Password will not work.

不确定我这样做是否正确,但我在 Logcat 中得到了这些

Not sure if I'm doing this right, but I got these in Logcat

D/EmailPassword: createAccount:chris884@gmail.com
 W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
 W/ResourcesManager: Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
 W/ResourcesManager: Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
 D/EmailPassword: createUserWithEmail:onComplete:false

推荐答案

logcat 输出显示用户帐户的创建失败.文档 表明这可能由于以下原因发生:

The logcat output shows that the creation of the user account is failing. The documentation indicates this can happen for these reasons:

  • 密码不够强(少于 6 个字符)
  • 电子邮件地址格式错误
  • 已经存在使用给定电子邮件地址的帐户

createUserWithEmailAndPassword()的完成监听器中添加Log语句,查看失败原因:

Add a Log statement to the completion listener for createUserWithEmailAndPassword() to see what the failure reason is:

@Override
public void onComplete(@NonNull Task<AuthResult> task) {
    Log.d(TAG, "createUserWithEmail:onComplete:" + task.isSuccessful());

    // If sign in fails, display a message to the user. If sign in succeeds
    // the auth state listener will be notified and logic to handle the
    // signed in user can be handled in the listener.
    if (!task.isSuccessful()) {
        Log.d(TAG, "onComplete: Failed=" + task.getException().getMessage()); //ADD THIS

        Toast.makeText(EmailPasswordActivity.this, R.string.auth_failed,
                Toast.LENGTH_SHORT).show();
    }

    // [START_EXCLUDE]
    hideProgressDialog();
    // [END_EXCLUDE]
}

这篇关于Android - Firebase 快速入门电子邮件/密码验证演示不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆