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

Solution 1:

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