Manual publishing is a chore and a waste of time as it involves a lot of steps which are redundant and can be easily automated.

Manual publishing requires these steps
  1. Create a signed APK for your app.
  2. Login to the google play developer account.
  3. Select the app and create a release.
  4. Upload the APK with changelog.
  5. Submit the update.
  6. Repeat the above 5 steps again for a new release.

Doing this again and again can become quite irritating after a while. Also, if you are uploading multiple APKs for every release then manual publishing would only lead to headaches.

So, automating this part can help save you some time which you can use to procrastinate ;)

Prerequisites
  1. Google play developer account.
  2. An already listed app in your developer account.
  3. CI (Continuous Integration) tool of your choice. I will use Travis CI for this tutorial as it is free to use with open source projects.

Signing your APK properly

In order to create a signed build of your app, you can either use AndroidStudio’s inbuilt UI (Build > Generate Signed APK…) or specify your keystore details in your build.gradle. We will use the latter as it is will help us automate the signing process for our app.

Add this snippet to your build.grade’s android section:

android {
    ...

    signingConfigs {
        release {
            storeFile file("someDirectory/my_keystore.jks")
            storePassword "my_store_pass_here"
            keyAlias "my_key_alias_here"
            keyPassword "my_key_pass_here"
        }
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

You can now run ./gradlew assembleRelease command to create a signed APK directly.

In the next part, we will discuss how to set up your google play developer account.

PS: In upcoming parts of this blog series, I will also explain how to secure your keystore details for your open source projects.

References:

  1. https://medium.com/@harmittaa/travis-ci-android-example-357f6e632fc4