As we all know that while working with the Agile development approach, developers have to be prepared for the changes & updates in requirements frequently and at the same time they need to deliver bug — free features as well. To deal with this it is mandatory to have a proper CI/CD environment which strengthens the developer’s confidence for experimenting with new features and pushing out its updates as quickly as possible.

With the proper CI, bugs can be identified easily and mobile app developers can review code faster as changes to code in a repository are usually merged a few times a day so it can be continuously validated.

Why CI / CD

There are so many pros of using GitLab CI / CD, but here are the main three reasons why we recommend it for small and medium android projects.

  1. One can build complete CI / CD pipeline with a single tool that is fast and open source.
  2. GitLab CI / CD is a one-stop solution for all your need i.e. create ticket, write code, merge code and setup CI / CD tool.
  3. GitLab Runners that is used to run your jobs and send the results back to GitLab. This allows running through the pipeline build faster compared to running in a single instance.

Lets Begin

Assuming that you are aware of creating an android application and familiar with the GitLab UI.

Setup GitLab CI

Create a GitLab CI config file, called .gitlab-ci.yml, and place it in the root directory of our project. Ref.

Apply Gradle Play Publisher plugin to your android ready code which allows you to upload your App Bundle or APK and other app details to the Google Play Store. Ref.

plugins {

id ‘’ version ‘2.0.0’


There are several options available to customize how your artifacts you want to publish. For example, we will release it on beta.

play {

track = ‘beta’ // set track for playstore (like alpha, beta, production)

serviceAccountCredentials = file(“your-key.json”)


Add JSON file with your private key.

serviceAccountCredentials = file(“api-project-871335108741–21d4874afk.json”)

Now go to Google play console

Click on API Access from burger menu

Click on Create Service Account

Click on Google play console and you will find below screen

Now click on “+ CREATE SERVICE ACCOUNT” at the top.

Type the name of your organization for the Service Account Name. Leave description blank.

> Click Create

> Select a role and choose Service Account > Service Account User. Click Continue.

Click Create Key at the bottom

Select JSON, Click Create.

A notice will pop up, “Private key saved to your computer,” and a JSON file will be downloaded automatically.

Go to your GitLab account and add a new project. Learn how to add a new project step by step from here. Push your android code for that project.

Go to Settings -> CI / CD

Add the variable key and value generated from the google play console developer account. Here You can learn more about Variable from here.

Whenever new code is pushed, the process can be viewed and manage from CI / CD Pipeline. See the below picture, where you can see all the Panging, Running, Finished jobs.

Web & Mobile App Development Company. Expertise in Mobile App,PHP, ASP.NET, MVC 5 (Razor),MongoDB, NodeJS, AngularJS, ReactJS,Windows App, POS, Scraping.