Android Firebase Tutorial – User Registration with Authentication

Hello friends, in this Android Firebase Tutorial, we will see how we can make User Registration in Android by using Firebase as our App’s backend. I have already posted an Android Firebase Tutorial.

But firebase is now taken by google and things are changed a little. That is why I am again posting this Android Firebase Tutorial. Today we will learn about making User Registration using Firebase Authentication for Android. If you are interested in Swift and iOS then you can go through this Firebase iOS Tutorial.

What is Firebase?

Firebase is a cloud service provider. It is now under google and this service can replace your whole server side part of your application. In many tutorials we had used MySQL and PHP for our database. But if we will use Firebase we do not need any server side code or configuration. We can directly use firebase. Firebase comes with a bundle of many features.

Features of Firebase?

firebase features

Android Firebase Tutorial – Video

You can keep on reading this tutorial but if you don’t want reading, you can watch this video. This is not like my other videos. This is a complete explanation of this post. So you can go through this video as well.

Android Firebase Tutorial

So without wasting time lets start our Android Firebase Tutorial. We will start from creating a new project.

From this tutorial you will see screenshots of OS X. 😛 Thanks to you guys, I managed to get MacbookAir with your support. 🙂

Creating an Android Studio Project

  • Open Android Studio and Create a New Project. I created FirebaseAuthDemo.
  • Now wait for your project, once it is fully loaded we can start working.
  • But before we need a app in Firebase Console as well. So switch to your browser from Android Studio.

Adding Firebase to our Project

getting started with firebase

  • Now click on create a new project. create a new project
  • Give your app a name and click on create project.

create a project

  • Now you will see the Firebase Panel. You need to click on Android Icon here.

firebase android tutorial

  • Now you will see a panel here you need to put the package name of your project. You can get the package name from AndroidManifest.xml file. Copy the package name and paste it here and then click on Add App.

firebase android tutorial adding app

  • When you click Add App, a file named google-services.json will be downloaded. You need to paste this file inside app directory of your project. See the below image for explanation.

firebase android tutorial adding googleservices

  • Now come inside your project level build.gradle file and modify it as follows.

  • Now modify your app level build.gradle file as follows.

  • Now sync your project with Gradle.

Adding Firebase Authentication

As in this Android Firebase Tutorial, we are building a user registration application, we need to use Firebase Authentication. So we need to add Firebase Authentication to our project. For this go inside app level build.gradle file and inside dependencies block add the following line.

Again sync your project.

Enabling Email/Password Authentication

  • Again go to your firebase panel.
  • On the left side menu you will see Auth, click on it.

firebase android tutorial enable auth

  • Now click on Set Up Sign In Method.

set up signin method

  •  Now click on Email/Password, enable it and press save.

firebase android tutorial user reg

Creating User Signup Form

  • Now we will need to create a form in our activity from where user can Sign Up to our app.
  • Come inside your Android Studio Project, and in activity_main.xml write the following code.

  • The above code will generate the following UI.

Firebase Android Tutorial

Understanding Firebase Signup

This is the main part of this Android Firebase Tutorial. First I will tell you about the methods. As we will be using Firebase Authentication for the user Signup we need these steps to get it done.

Step #1

First we will define a FirebaseAuth object. Then inside method onCreate() we will initialize this object. See the following code snippet.

Step #2

Now we will call the method createUserWithEmailAndPassword() from the FirebaseAuth object. This method take two String parameters for email and password. And we attach a OnCompleteListener on it to check the task is completed or not.

Implementing Firebase Signup

We understood the code. Now lets implement it to make registration work in the activity. Write the following code in your

  • Now lastly add internet permission to your AndroidManifest.xml file.

  • Now run your application. firebase android tutorial
  • Click on Signup and if you got the success message. Check your firebase console.

firebase android tutorial register user

  • Bingo! the registration is working fine. You can get my source code from the link below.

So thats all for this Android Firebase Tutorial friends. In the next post we will see about user login and other options like Password Reset, Email Change, Delete Account etc.

And yes feel free to leave your comments if having any confusions regarding this Android Firebase Tutorial. Thank You 🙂

60 thoughts on “Android Firebase Tutorial – User Registration with Authentication”

  1. Great and detailed tutorial.But how can I add other details to a user during registration? Say i want the user to register with name, birthday, address etc.

    • u can use HashMap

      like that
      HashMap dataMap = new HashMap();

      dataMap.put(“Name”, strfullname);
      dataMap.put(“Username”, strusername);
      dataMap.put(“Email”, stremail);
      dataMap.put(“Phone”, strphone);


      • Need a tutorial to explain the use of HashMap to store data like name, username, phone no., and other details with registration and show them in profile activity and then login with that username instead of email.I think you got what i want to do with that.
        your tutorial are really awesome and helpful for the starters.Eagerly waiting for your response….

        Thank you.

  2. Nice tutorial. My first attempt was with a password of 5 characters and it did not work , but the second try with 10 characters succeeded.

  3. Hello, Can you help me? I have a error with firebase auth: Local module descriptor class for not found. And Google store is missing.

  4. I have a error: Local module descriptor class for not found. And Google store is missing. Can you help me fix this error please?

    • add internet permission in manifest file and add the dependency
      implementation ‘’
      implementation ‘’

      implementation ‘’

  5. Hey I wanted to ask, how to handle if the user is already registered with his email. Will firebase allow new registration with an email that is already registered?

  6. great job man. i have a query. please reply
    after successful registration, on the registration page the id and password still remains. how to get them blank after successful registration

  7. Nice tutorial brother but i am successful only to register one user in firebase when i tried to enter another than my app display registration failed .Can u pls find the solution for this ?

  8. I get Error As
    E/EGL_emulation: tid 4868: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)

    When I click Regisrer Button ProcessDialog goes on processing without end

  9. Great tutorial man , but can u make the tutorial that included upload profile picture instead of just email and password please. Thanks again!

  10. Thank you, sir, your tutorial is very help full for me
    how can we retrieve data from “firebase”

    and Sir i am working next Project based on “android-fingerprint-authentication”

    can u plz help me

  11. how can i create different UI for different user login. in my app i have 3 users : principle, HOD and teachers . Each having different work. teachers apply for leave .. and.. forwarded to HOD(rejects/forward) ..and.. forward to principle(rejects/accepts) and teachers get notified with the status .

  12. if i can register user’s email and password in firebase database then how to i verify that email and password in user’s login page..

  13. great job dude. i really loved your work! my question is why is it taking a limited number of characters when i type email.

  14. Thnk you so much Sir…
    It helps..
    but when i m adding the user permission it is throwing some error, but it is working without it.

  15. hi there, i have successfully created this app, but when i have tested for if email and password field is empty toast,i clicked the signup button without filling the email and password field and the app is getting crash,please help me with that,
    thank you


Leave a Comment