how to connect with firebase in android studio manually
To connect your Kotlin Android Studio project with Firebase manually, you need to follow these steps:
Create a Firebase project: Go to the Firebase website (https://firebase.google.com/) and create a new project. Give it a name and select your preferred options.
Add your app to the Firebase project: After creating the project, click on "Add app" and select the Android platform. Provide the package name for your app (usually found in the
AndroidManifest.xml
file) and click on "Register app".Download the
google-services.json
file: After registering your app, you will be prompted to download thegoogle-services.json
file. This file contains the configuration details for your app to connect with Firebase.Add the
google-services.json
file to your project: Place the downloadedgoogle-services.json
file in theapp
module of your Android Studio project. Make sure the file is located inside theapp
folder.Add the Firebase SDK dependencies to your project: Open your project's
build.gradle
file (located in the root directory) and add the following dependencies:
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
// ...
repositories {
// ...
mavenCentral()
}
}
And in your app module's build.gradle
file (located in the app
folder), add the following dependencies:
dependencies {
// ...
implementation 'com.google.firebase:firebase-analytics:18.0.3'
implementation 'com.google.firebase:firebase-auth:21.0.1'
// Add more Firebase dependencies as needed
}
- Apply the Firebase plugin: Still in the
build.gradle
file of your app module, add the following line at the bottom:
apply plugin: 'com.google.gms.google-services'
- Sync your project: Sync your project with the Gradle files by clicking on the "Sync Now" button in the toolbar.
That's it! Your Kotlin Android Studio project is now connected with Firebase. You can start using Firebase services in your app by following the Firebase documentation and integrating the required APIs in your code.