Firebase is a development kit for adding core infrastructure features to mobile apps and Google Cloud Platform projects. Sometimes called “backend-as-a-service,” it helps bring secure and scalable capabilities to your projects.
This post guides you in creating a connection between Firebase and your app. It uses Gradle’s Kotlin DSL in a native Android project compiled on macOS.
Firebase Project
-
Navigate to the Firebase Console, and then Add project.
-
Set its name and create your project.
-
Navigate to its overview dashboard, then Add app and select the Android platform.
-
Register the app’s package name. Log your machine’s fingerprint with the keytool CLI. The default password for the android debug keystore is android.
keytool -list -v -alias androiddebugkey -keystore ~/.android debug.keystore
``
-
Copy/paste the SHA1 value into the Firebase field where requested.
-
Download the project’s
google-services.json
config file.
Android Project
-
Move the downloaded
google-services.json
within the app module. -
Add the Google Services Plugin to the project’s buildscript:
classpath("com.google.gms:google-services:4.3.1")
. -
Apply the plugin below the app module’s dependencies closure,
apply(mapOf("plugin" to "com.google.gms.google-services"))
.
Run the app and watch the Firebase console to confirm successful installation. Now you’re ready to select from helpful Firebase solutions. Some of them will need the Analytics feature configured too. Integrating specific products will be an exercise for the reader until a future post.