Release automation on Android

Release automation on Android


Publishing an app in production can sometimes be a rather heavy process. To complete this phase it is necessary to perform a series of tasks, such as the distribution of betas, screenshots, translations for multi-language, APK signature, etc., which can be very laborious if it is not automated in some way. Also when there are also different application versions (freemium, premium…) things get even more tedious.

The multi-language, by the way, is one of the points that requires a lot of time and effort, when maintaining and publishing an app. That is why, before jumping into the pool, ready to keep many languages, I suggest you stand up to assess whether compensated or if on the contrary it is worth to be less ambitious at this point , because if you want to do well, a new language implies new translations for the texts of the app, new translations of title and description tab in the Google Play or in the store, that is, new translations for the texts of update version of the app and new screenshots in the appropriate language, among other things.

Well, to spare us part of all this work, let’s discuss things we can do to automate it. Let’s mainly comment on three points with which to automate our process of distribution and publication of an app on Android. With the help of Gradle and a series of Android libraries we will save a lot of time and outstaffing work.

    1. Automatic betas distribution with Crashlytics



    1. Screenshots and icon generation for Google Play



    1. Auto signature APK



Betas distribution with Crashlytics

If we are using Crashlytics in our app, we can do the generation and distribution of betas automatically, simply by establishing some basic configuration parameters in our file build.gradle of the app module, in the part where the build variants are defined. In this way, we parameterize the target users and the “release notes” so that when executing the command crashlyticsUploadDistributionRelease, the distribution is done automatically. Example:

In this link you can see this in more detail:

Screenshots and icon generation for Google Play

Another of the tasks that we have to go through when publishing on Google Play is to provide the corresponding icons and screenshots of our app. Google Play, requires that we provide an icon of 512 x 512 px and another of 1024 x 500 px of our app. This will be the icons that the user will see in the app Finder. And it also requires that we provide at least 2 images or screenshots of our app. This, in itself, is not very expensive, but if our app has multi-language, the correct thing is to provide the corresponding icons and screenshots, since surely our app will have texts that will change according to the language and this is what ends up being a quite expensive job.

This is where we’re going to start delegating Espresso, the Android framework for user interface testing. Thanks to Espresso, JUnit Rules and the bookstore Spoon, we can capture each screen of our app in the corresponding language automatically.

Rules JUnit

The JUnit rules, expressed by annotations, serve to intercept the calls to the test method and allows us to do something before and after the invocation. In our case we’re going to use a @ Rule, which will facilitate the handling of permissions to store screenshots. Specifically we will use GrantPermissionRule, which is included in the Espresso library. And one @ ClassRule for the “local” part, which will be in charge of running the test in each language we want. This we will have to implement it ourselves as follows:

Spoon Screenshots


To take screenshots, simply add the gradle dependency of the Spoon client library. For screenshots to be saved, your application must have the permission WRITE_EXTERNAL_STORAGE.

To make a capture at some point in the test, it’s as easy as this:

Here I show an example of UITest that makes use of the rules of JUnit and Spoon to automate the screenshots in 7 languages:

Auto signature APK

And finally let’s see how to sign our APK, automatically in Android Studio since Android requires that all APKs be digitally signed with a certificate to be installed.

Configure the build process to automatically sign your APK

In Android Studio, you can configure your project to automatically sign the release APK during the build process by generating a signature setting and assigning it to your release build type. A signing configuration consists of a keystore location and password, and a key alias and password. To generate a signature configuration and assign it to your release build type using Android Studio, follow these steps:

  • In the window Project, right-click on your app and then primary click on Open Module Settings.



  • In the window Project Structure, section Modules in the left pane, click the module you want to sign.



  • Click on the tab Signing and then in Add +



  • Select your keystore file, enter a name for this signature setting and the required information.




Window to create a new signature configuration.

5. Click on the tab Build Types.

6. Click on the build release.

7. In Signing Config, select the settings you just created.


Selecting a signature setting in Android Studio.

8. Click on OK.

Now, every time you build your release build type using Android Studio, the IDE will automatically sign the APK with the settings you specified. You can find your signed APKs in the build/outputs/apk / folder within the project directory of the module you build.


Task automation is basic when making distributions and publishing an app. Here we have only commented Some of them that will save us a lot of work and we have not even come to talk about Continuous Integration, topic that we can leave for another post. It is also true that there are very powerful tools such as fastlane to automate the publishing and distribution processes, but it has the drawback of not being officially compatible with all operating systems, so, to write this post, I wanted to rely only on tasks from Gradle and official libraries such as Espresso and Spoon available for Android.


A test rule for setting device locale

Ready to see us in action:

More To Explore
Enable registration in settings - general
Have any project in mind?

Contact us: