How to share Android apk using firebase app distribution and gradle

Developing android apps is a very hardworking task. It is not that simple and easy. On top of it when we have to share the APK for testing it become a nightmare if we do not use any proper tools. Today we will discuss about the apk distribution tool which is provided by Firebase. It very handy and easy to implement and use.

What is Firebase App Distribution

Firebase app distribution is a tool where you can put the email addresses of your QA/testers in a list and when you publish your app for testing, Firebase will send an email to all the QA using the email list including a message about which module or bug or new feature is implemented. You just have to run a single command from your terminal. Or you can also upload your apk to your firebase panel. Firebase will take care of the rest.

Step 1: Integration

First of all we need to integrate the firebase library. You can read the documentation in details from this link. Here we will use gradle to implement this tool. Open your root level build.gradle and add this following code:

dependencies {
    classpath ''

You can use the latest version. Right now its 2.1.3. After this you have to open the app level build.gradle and add the following code at the top:

apply plugin: ''

That’s it. Integration is done. It’s that simple.

Step 2: Link your firebase project

In order to link your Firebase project to Android Studio you need to run the login command. Open the terminal window of Android Studio or open the default terminal and locate your project in it. Run the command below:

./gradlew appDistributionLogin

As output you will see a google link in the terminal. Open it in your browser and login to your gmail account used in firebase project. After successful login get back to your terminal and you will see a token. Now run the below command:

export FIREBASE_TOKEN=your_token

linking your project is done.

Step 3: Publish app

Now it’s time to publish your app. Open your app level build.gradle and paste the code below in your android > buildTypes:

debug {
     firebaseAppDistribution {
        releaseNotes="Your message"

Whenever you implement something new or fix any bug just change the releaseNotes and run the final commands below:

export FIREBASE_TOKEN=your_token
./gradlew assembleDebug appDistributionUploadDebug

Your app will be uploaded to firebase automatically and from there an email will be sent to all your qa. You can save the last 2 commands anywhere so that you wont have to follow the whole step again after restart or shutdown your computer.