13th Nov 2018

Fastlane: An automated app deployment tool – Part 3

Mobile App

Written By, Shubham Sejpal



The Fastlane is the automated tool for deploying the entire apk and screenshots of the application on the app store.

Fastlane has the following capabilities:

  • Make a repeatable custom work process to build, upload and distribute new releases to the play store.
  • Upload and deal with the more significant part of your application’s metadata including screen captures.
  • Automatically submit new versions of your application for review.


Fastlane helps developers by publishing/uploading an app screenshot along with all the necessary details with just a few commands.

In this part of the series, I’ll explain how to grab the screenshot automatically from the functionality of Fastlane. It allows you to:-

  1. Catch many screenshots in numerous languages on any simulator.
  2. Arrange it once, and store the setup so anybody on the group can run it.
  3. Get an outline of how your application looks like over every single supported devices and dialect.
  4. Accomplish something unique while the computer takes the screen captures for you. (Time-Saving)

We have finished the installation process in our previous Part 2 blog of Fastlane. Fastlane captures the screengrab automatically.

Setup the Espresso(If not found in gradle)

screengrab utilizes the capacities of Android’s worked in Instrumented tests joined with Espresso to drive communications with your application.

Add this dependency in your build.gradle file if it is not located(Generally, it is by default):-

Setup the Android JUnit Test Runner

AndroidJUnitRunner is necessary for Android Test coding so please don’t remove it from build.gradle if you, unfortunately, removed it then please add it again.

Setup the Screengrab

Open the terminal and run the following command to install the gem for screengrab.

Add the test dependency in the build.gradle file.

Permission to be needed for screen grabbing

Add the list of permission in your AndroidManifest.xml file to capture the screenshot and store the screenshot in the phone storage and change the locales for different languages.

Configure the Screengrab test code

  1. For automatically switching of locales you have to add the following code in your ExampleInstrumentedTest.java code.

  1. For capturing the screenshots add the following line in your test code.

Example Code

Here is the ExampleInstrumentedTest.java which will perform the sleeping activity and manage the locales for taking the screenshots. (Locale will help you when we have a single app with the multiple languages)

Edit the fastfile

Create the new lane for capturing the screenshots and upload it to the app store by adding the following lines to your fastfile.

Deploy your screenshots on Google Play Store

Now execute the fastlane screenshots command in the terminal after going inside the path up to the project folder and your screenshots will be live on the google play store within a few hours.


Written By,

Android Developer at Yudiz Solutions Pvt. Ltd