How to setup Firebase in React Native CLI (For Android)

·

2 min read

1: Open Firebase Console and click on create new/add new Project

2: Give name for your project and then press continue,then again press cotinue and then in 3rd choose Configure Google Analytics Location according to your location, accept the Google Analytics terms and press on create project.After creating project it will redirect to you to the project overview screen.

3: Add Firebase to your android app:

Press on android button as give below,

when we press on it it will redirect us to Add Firebase to your Android app Page Here you have to give android package name to your app , to get android package name, open android>app>build.gradle file inside this file you search applicationId then inside this you have an application name as given indside this image

then press Register App

4: After that it will give us google-service json file ,we have to download it and addd inside android folder as given in the image

after configure this press next and then we have to install some require dependencies in our current project

5:Add Firebase SDK to your project

Choose Groovy (build.gradle) then copy plugin add it to the android>build.gradle file add it inside dependencies {......}.Then scroll down click on java checkbox

add google gms inside android>app>build.gradle replace id by apply plugin

instead of this : id 'com.google.gms.google-services'

use this: apply plugin: "com.google.gms.google-services"

add other stuff like dependencies

after this press next and go to console .