title: Firebase authentication registration Error occured
body: <p>I'am try to register a user in my android app with using Google Firebase authentication option, but i am getting error and my <code>Toast</code> handle my error in this code line <code>Toast.makeText(RegistrationActivity.this, "Sign Up Error!", Toast.LENGTH_SHORT).show();</code></p>
  
  <p>I think my SHA-1 and firebase connection was linked right. Firebase console image attached below 
  <a href="https://i.stack.imgur.com/OnEuh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OnEuh.png" alt="firebase console"></a> </p>
  
  <p>I'm here add my source code and also xml file.</p>
  
  <pre><code>package com.example.anu.activityone;
  
  import android.content.Intent;
  import android.support.annotation.NonNull;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  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 com.google.firebase.auth.FirebaseUser;
  
  public class RegistrationActivity extends AppCompatActivity {
  
  private EditText txtEmail, txtPassword;
  private Button btnRegister;
  
  private FirebaseAuth mAuth;
  /*
      public abstract class FirebaseAuth extends Object
      The entry point of the Firebase Authentication SDK.
   */
  private FirebaseAuth.AuthStateListener FirebaseAuthStateListener;
  /*  FirebaseAuth.AuthStateListener  is a interface,
      that Listener called when there is a change in the authentication state.
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_registration);
  
      // method called when user logged in or logged out
      mAuth = FirebaseAuth.getInstance();
      FirebaseAuthStateListener = new FirebaseAuth.AuthStateListener() {
          @Override
          public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
              final FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
              if(user != null){
                  Intent intent = new Intent(RegistrationActivity.this, MainActivity.class);
                  startActivity(intent);
                  finish();
                  return;
              }
          }
      };
  
      txtEmail = (EditText)findViewById(R.id.email);
      txtPassword = (EditText)findViewById(R.id.password);
      btnRegister = (Button)findViewById(R.id.register);
  
      // Register a new user
      btnRegister.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              final String email = txtEmail.getText().toString();
              final String password = txtPassword.getText().toString();
              /*
                  Support User Registration
                  With password-based authentication, new users must register themselves by providing
                  a unique email address and a password. To add this functionality to your app,
                  you can use the createUserWithEmailAndPassword() method of the FirebaseAuth class.
                  As its name suggests, the method expects an email address and a password as its arguments.
               */
              mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(RegistrationActivity.this, new OnCompleteListener&lt;AuthResult&gt;() {
                  /*
                      public interface OnCompleteListener
                      Listener called when a Task completes.
                   */
                  @Override
                  public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                      if(!task.isSuccessful()){
                          Toast.makeText(RegistrationActivity.this, "Sign Up Error!", Toast.LENGTH_SHORT).show();
                      }
                  }
              });
              /*
                  To be able to determine the result of the createUserWithEmailAndPassword() method,
                  you must add an OnCompleteListener to it using the addOnCompleteListener() method.
               */
          }
      });
  }
  // To start Firebase authentication
  @Override
  protected void onStart() {
      super.onStart();
      mAuth.addAuthStateListener(FirebaseAuthStateListener);
  }
  // To stop Firebase authentication when app pause
  @Override
  protected void onStop() {
      super.onStop();
      mAuth.removeAuthStateListener(FirebaseAuthStateListener);
  }
  }
  </code></pre>
  
  <p>XML file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="com.example.anu.activityone.RegistrationActivity"
  android:orientation="vertical"&gt;
  
  &lt;EditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:hint="email"
      android:id="@+id/email"/&gt;
  &lt;EditText
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:hint="password"
      android:id="@+id/password"/&gt;
  
  &lt;Button
      android:id="@+id/register"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="Registration" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>