How to connect android studio with Firebase
Tags: android, firebase
Published: 2022-12-13 04:45:00

I am sure you have started your journey of learning android development and then this mountain of problems came, but do not worry I help you out just follow the steps and follow my lead.

The first step is to make an account on Firebase. Now you have made one let’s get started.

Open the ram eater, oops! I mean android studio and Firebase in the browser in the Firebase

## Follow the steps

### 1. Create a project on Firebase

Open your Firebase account and click on Add project

![Add project to firebase](https://cdn-images-1.medium.com/max/3840/1*w-yIPasP9AQbzGXG3uwyBQ.png)

### 2. Project Name and other details

Give your project a name in my case I have used the name “Test” and click on continue. 
For now, we will turn off google analytics and proceed, click on create a project and sit back and relax till Firebase creates your project.

![Disable google analytics in Firebase](https://cdn-images-1.medium.com/max/3840/1*RKcgHCh-n0uEdu4li2Evug.png)

### 3. Adding Firebase to App

Click on the android icon and now we have a list of tasks to do.

First, you fill in the package name, you can find the package name in the build.gradle, and in the file under the namespace, you can find your package name.

![Adding android app to Firebase](https://cdn-images-1.medium.com/max/3840/1*E8rPczek-6jbn0ee4-4fZA.png)

Well, some services of Firebase require a SHA1 key and I know it took me a while to out find how to get one. Fire up the android studio and open the run anything cmd execute to open “run anything” double press the Ctrl button and in the window type “signingReport” and hit enter.

![Generating signingReport in android studio](https://cdn-images-1.medium.com/max/3840/1*26UzStAW9M-d9qDzsxh3qQ.png)

Now a window will open and it will be showing your MD5, SHA1 and SHA256 keys from here copy SHA1 and paste it into the SHA1 input box on the firebase page.

![Getting SHA1, SHA256 and MD5 keys](https://cdn-images-1.medium.com/max/3840/1*XEoB9u67uFaNXNQhKJJ5og.png)

Now, click on the register.

### 4. Add the config file

Download the config file and copy it. Now open android studio and there change the view from android to project, move to the app > src directory, and paste the file here.

![Adding google-service file in android projects](https://cdn-images-1.medium.com/max/3840/1*0QLDiaSdseoc4Co6IIKk7w.png)

Now go to the Firebase page and click on next.

### 5. Add Firebase SDK

In this step simply copy the dependencies mentioned and paste them into the mentioned Gradle files. You have two build.gradle file one is app level and another is module level.

Note:- those who use Gradle 7.+ will not see any dependency section in the build script in the project-level Gradle file so simply add the dependency section.

Now your app is successfully connected to firebase.

To learn how to use Firebase services I suggest you build some projects using it and I think the notes application is one of the best projects beginner-level application that you can build to learn Firebase. Here are some suggestions use Firebase authentication to provide auth service to the app, use the cloud store as a database and store the notes of the user and just see some services like analytics, crash analytics, and messaging that Firebase provides, these services you will be needing when you publish your apps as these will allow you to monitor the crashes and app performance.