'I get error in firebase "An unknown error occurred while loading users" and when I try to register new account it shows registraion failed

I am using sdk version 30.

#when in try to register a new account even if I have entered all fields correctly it shows this

enter image description here

also in firebase console I get error "An unknown error occurred while loading users"

I have only 3 fields in registration form 1)Email, 2)Password 3)confirm password

package com.example.login;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.content.Intent;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;

import java.util.Objects;


public class AcRegistration extends AppCompatActivity {


    EditText txtEmail, txtPassword, txtConfirmPassword;
    Button btn_register;
    private FirebaseAuth firebaseAuth;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ac_registration);
        Objects.requireNonNull(getSupportActionBar()).setTitle("Registration Form");


        txtEmail = findViewById(R.id.txt_email);
        txtPassword = findViewById(R.id.txt_password);
        txtConfirmPassword = findViewById(R.id.txt_confirm_password);
        btn_register = findViewById(R.id.RegisterAC);

        Button button2 = findViewById(R.id.Login2);


        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent= new Intent(AcRegistration.this,MainActivity.class);
                startActivity(intent);

                firebaseAuth = FirebaseAuth.getInstance();
            }
        });

        firebaseAuth = FirebaseAuth.getInstance();

        btn_register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String email = txtEmail.getText().toString().trim();
                String password = txtPassword.getText().toString().trim();
                String confirmPassword = txtConfirmPassword.getText().toString().trim();



                if(TextUtils.isEmpty(email)){
                    Toast.makeText(AcRegistration.this, "Please Enter Email", Toast.LENGTH_SHORT).show();
                    return;
                }
                if(TextUtils.isEmpty(password)){
                    Toast.makeText(AcRegistration.this, "Please Enter Your Password", Toast.LENGTH_SHORT).show();
                    return;
                }
                if(TextUtils.isEmpty(confirmPassword)){
                    Toast.makeText(AcRegistration.this, "Please Confirm Entered Password", Toast.LENGTH_SHORT).show();
                    return;
                }
                
                if(password.length()<6)
                {
                    Toast.makeText(AcRegistration.this, "Password To Short", Toast.LENGTH_SHORT).show();
                }
                
                if (password.equals(confirmPassword))
                {



                   firebaseAuth.createUserWithEmailAndPassword(email, password)
                            .addOnCompleteListener(AcRegistration.this, new OnCompleteListener<AuthResult>() {
                                @Override
                                public void onComplete(@NonNull Task<AuthResult> task) {
                                    if (task.isSuccessful()) {

                                        startActivity(new Intent(getApplicationContext(),home.class));
                                        Toast.makeText(AcRegistration.this, "Registration complete", Toast.LENGTH_SHORT).show();

                                    } else {

                                        Toast.makeText(AcRegistration.this, "Registration Failed", Toast.LENGTH_SHORT).show();

                                    }
                                }
                            });

                }

            }
        });


    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source