How to create project
Step 1: Create project
- Go to: https://console.firebase.google.com/u/0/
- Click Add Project
- Enter a name, disable
Google Analytics, click Create project
Step 2: Get google-services.json
- Click on the corresponding app to add app
Android
- Input
package name - Download
google-services.json, place atandroid/app
Step 3: Add firebase SDK
- Open
app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
// add this line
apply plugin: 'com.google.gms.google-services'
// ...
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// add this line
implementation platform('com.google.firebase:firebase-bom:32.1.1')
}
tip
Usually, you need to add two lines apply plugin, and implementation platform...
- Open
build.gradle
buildscript {
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
dependencies {
...
// Add the dependency for the Google services Gradle plugin
classpath 'com.google.gms:google-services:4.3.15'
}
}
allprojects {
...
repositories {
// Make sure that you have the following two repositories
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
}
tip
Usually, you only need to change only 1 line at classpath