Table of Contents

Before we can setup Firebase Cloud Firestore, we need to setup our project first for Firebase.

1. Creating a new project in Android Studio

1. Create a new project in Android Studio through File -> New Project and select Empty Activity as your template.

2. Set your Application name to FirebaseChat or any name that you want.

2. Creating a new project in Firebase

1. Go to https://console.firebase.google.com/

2. Add Project

3. Set the project name to FirebaseChat or any name that you want.

4. Choose your country

5. Click Create Project

3. Adding Firebase to your Android app

After you have created your project, you will be redirected to your project console.

1. Click Add Firebase to your Android app

2. Enter the package name of the project that we created in Android Studio.

If you don’t know your package name, open your app-level build.gradle under app/ directory and look for applicationId.

3. Click Register App

4. Download your google-services.json file and follow the instructions provided. Copy the google-services.json file that you just downloaded and paste in under app/ directory as seen from the instructions.

5. Click Continue.

4. Adding Firebase gradle dependencies

After you click continue, you will be given instructions on how to the gradle dependencies.

1. In your project-level build.gradle file:

buildscript { ... dependencies { ... // Add this line classpath 'com.google.gms:google-services:3.2.0' } }

As of this writing, the latest google services version is 3.2.0. Make sure to use the latest version as seen in the instructions provided by Firebase.

The latest version of Firebase libraries can be found under available libraries.

2. In your app-level build.gradle file:

dependencies { ... // Add this line implementation 'com.google.firebase:firebase-core:12.0.1' } // Add to the bottom of the file apply plugin: 'com.google.gms.google-services'

3. Click sync now

5. Adding Firebase Cloud Firestore

1. In your app-level build.gradle file:

dependencies { ... // Add this line implementation 'com.google.firebase:firebase-firestore:12.0.1' }

Now that our project is setup for Firebase Cloud Firestore, it’s time to implement our authentication feature.