简体   繁体   中英

Android - Firebase Quickstart Email/Password Auth demo doesn't work

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

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:

  • 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.

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

  • On my device Google Play Services is version 9.4.52

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.

Edit: 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

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

  • the password is not strong enough (less than 6 characters)
  • the email address is malformed
  • there already exists an account with the given email address

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]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM