If you are new to Firebase on Android. It looks quite overwhelming. But in practice it should not be that hard to create your first Android Firebase project.
Let me provide you a step by step instruction on how you can create an Android Firebase Project.
Create Android Firebase Project
First, head over to this site: Firebase Console and then click on
create a project button.
After that you have to provide a name for your project. I have picked a random name here, but provide a meaningful name for your project.
Once you are satisfied with the name you picked click
Now you will have a screen that tells you to opt in for analytics. It’s your choice there are no side effects to using the analytics platform, except maybe user privacy ?
You can have pretty decent statistics for users who use your application. But again it’s your choice.
Decide to either opt-in or opt-out and click
Depending on your previous choice you might see an additional screen. The screen will ask you to select the location. Also it will ask you to accept the license.
Select the location that you think is reasonable for you. And if you are targeting this app to international users. Make sure you select the appropriate location. That data transfer will be a bit faster.
Finally, click on Create project once you’re done configuring your settings.
It might take some time to setup your project so have some patience.
You will have a success screen like below once everything is setup. Let us click Continue and move in.
That was it for the creating project portion. Now let us see how we can link our android application to this fresh project.
Create Firebase Android Application
In the project dashboard you should see something like shown in the image below.
Click on the Android icon right next to iOS. We will have to complete 4 steps to link our app to Firebase.
The very first step is the app registration or register app.
You have to fill in three details in order to continue the application registration process. If you look below I have filled in the details for some input boxes.
Yes, that’s right you don’t have to fill in everything only the important one here is Android package name.
You have to provide your android application’s package name. To find your android package name you have to simply open AndroidManifest.xml. After that you have to find the
portion. And that is your package name. You have to copy the value from inside
" " as it is.
Once you are done click on Register app.
Once the app registration is complete you will see the screen below.
You have to download the
google-services.json file and put it inside your project’s
So click on
Download google-services.json and open the project’s root folder. And put the
google-services.json inside the
After completing the above process, click Next.
After the process above is complete. We have to add Firebase dependencies in our project.
This portion is a bit more involved that the previous one. In the project setup you will see bunch of instructions. But in reality the actions you have to perform are a bit simple.
You have to ad the line below to your project’s root directory’s
build.gradle file. Make sure that you don’t add it inside the
build.gradle inside the app folder.
Add the line below in the
So now your build.grade file will look something like shown below.
Also there is one more step we have to do here we have to add the dependencies in our
So add the following dependencies to your
implementation platform('com.google.firebase:firebase-bom:28.2.0') implementation 'com.google.firebase:firebase-analytics'
And now your build.gradle file should look something like this:
This is just an example. The Firebase dependencies are modular so you can select your necessary library and add it. You can visit this link to see the
Firebase Realtime Database library.
After you have setup everything you can click Next. And the integration portion is almost over. The last screen only shows you that you have successfully completed the integration.
You can just click on
Continue to console.
You should see the app we just created at the top of the dashboard.
Now was that so complicated ? I don’t think so.
You have now successfully created a firebase project. In other tutorials I will provide the instructions on how you can use the realtime database and other stuffs.
Till then keep coding.