Android Application -> Firebase Distribution
Steps to configure your android application to distribute to Firebase in CI/CD
Create a service account:
On the Google Cloud Console, select your project and create a new service account.
Add the
Firebase App Distribution Adminrole.
Create a private JSON key.
Enable the Firebase App Distribution API. When prompted, select the project with the same name as your Firebase project.
Encode the service account creds using base64
base64 service-account-credentials.jsonThen put this encoded value in code build env_vars of the build project with the name
SERVICE_ACCOUNT_CREDENTIALS_ENCODEDand typePARAMETER_STORE (secrets manager)To decode the credentials and write to file, run the below command in build.
echo $SERVICE_ACCOUNT_CREDENTIALS_ENCODED | base64 -di >> <CODE_DIR>/app/service-account-credentials.jsonChanges in App Config:
Add the below dependency in
apps/crm-agent-mobile-app/android/build.gradle>buildscript>dependencies
classpath('com.google.firebase:firebase-appdistribution-gradle:4.0.0')Add the below line at
app/build.gradle(belowcom.android.applicationplugin)
apply plugin: 'com.google.firebase.appdistribution'Add the below snippet in
app/build.gradle>/android>buildTypes>release
firebaseAppDistribution {
appId="1:1234567890:android:321abc456def7890",
artifactType="APK"
releaseNotesFile=""
serviceCredentialsFile="app/service-account-credentials.json"
groupsFile=""
}Update
releaseNotesFile,groupsFilepaths.groupsFilefile contains comma-separated testers' group names.For more details on other attributes here, go through Distribute gradle
How to Distribute?
Run the below command to build and distribute the app to firebase.
./gradlew assembleRelease appDistributionUploadReleaseLast updated