Prerequisites
- Android 4.0 (Ice Cream Sandwich) or newer
- Google Play services 11.0.2 or higher
Add Firebase
Click Android Studio > Tools > Firebase
to open Firebase Assistance.
Select and expand a feature, click on tutorial link. E.g. to add Invites, click on Send Firebase Invites from your app.
Click Connect to Firebase
Gradle config parsing error
Error: Could not parse the Android Application Module's Gradle config. Resolve gradle build issues and/or resync.
was shown. I troubleshoot my project's build.gradle
and found the following line to be the culprit.
// Firebase Assistant - Connect to Firebase hate this library
// compile 'com.google.api-client:google-api-client:1.22.0'
// compile 'com.google.http-client:google-http-client-gson:1.22.0'
Another possible reason is gzip files in your project might be the culprit.
Existing google-services.json error
Error: A config file "app\google-services.json" was found, but it indicates a project ID "xxx" that you dont appear to have access to. Request access or delete the file in order to proceed with the connection process.
was shown as I already have a google-services.json
file due to previous Google Play integration.
To solve the above error, visit https://console.firebase.google.com/u/0/ and click on Import Google Project.
This represents the country/region of your organisation/company. Your selection also sets the appropriate currency for your revenue reporting. The selected country does not determine the location of your data for Firebase features. Google may process and store Customer Data anywhere Google or its agents maintain facilities
You shall be prompted to select country with the above explanation: seems like the country is only used for reporting purpose and doesn't not affect server/storage location.
Next you shall be asked to Confirm Firebase Billing Plan. Since my Google Cloud project already have billing enabled, I can't select the free Spark Plan and have to opt for play as you go Blaze Plan. Based on the HN discussion, it seems like Blaze Plan could still enjoy the free tier quota for Spark Plan, though it's not exactly clear or confirmed.
**Note: ** make sure you use sigin to Firebase and Android Studio using the same account.
Continue with "Connect to Firebase"
Click Connect to Firebase.
Proceed to sync existing project (the following screen only appear if already have google-services.json
file due to previous Google Play integration).
Add Firebase Invites to your app
Assumption: you are adding Firebase Invites feature.
Click Add Firebase Invites to your app.
I avoid clicking Accept Changes as it will reformat my project's build.gradle
config file. I prefer to add the following entry manually.
Edit project's build.gradle
.
...
dependencies {
...
compile 'com.google.firebase:firebase-invites:11.0.2'
}
apply plugin: 'com.google.gms.google-services'
Edit root level build.gradle
.
buildscript {
...
dependencies {
...
classpath 'com.google.gms:google-services:3.1.0'
}
}