Auto Publish using Gradle Play Publisher

Android’s unofficial release for Automation on Play Store using Gradle Play Publisher (GPP).

Image by Aman Jham

In modern development, every one adapting smart work and Automate the progress as much as can do. In the mobile app development, publishing apps on the store and keep tracking the changes can be restless. And If you are the part of big developer teams to track their changes and who has what access is extensively torture.

How about I tell you about a simple solution for all of this with extra features to improve productivity just pushing your code to git and your app will be live on play store and other metadata also pushed using this publisher.

For automate publishing app, We have these options to use:

  1. Jenkins
  2. Fastlane
  3. CI
  4. GPP (We will talk about this)

Now grab a cup of coffee, and let’s begin to follow simple three steps !!

Step 0:

Initial Play store publishes; you need to upload singed Apk or bundle with your developer key using Google play console first time. Because the store can not link the app using play developer API.

Service Account, For using GPP, we must need a service account on the play store. Navigate to Setting > API access > create a Service Account and follow the instruction. For more details, you can check here.

Microsoft tutorial for generating a service account.

Step 1:

Add Gradle Play Publisher Dependencies in your project level:

buildscript {
repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots")
}
dependencies {
classpath "com.github.triplet.gradle:play-publisher:2.8.0-SNAPSHOT"
}
}

After adding this, your grade will look like this. Now add the plugin in app-level build.gradle, “your-server-account-key.json” is one Json file from service account when creating an API key for an account on google console.

apply plugin: 'com.github.triplet.play'play {
serviceAccountCredentials = file("your-server-account-key.json")
}

Step 2:

Run ./gradlew bootstrap or some other GPP task to validate your setup, and this will add Play store details such as Icon, feature-graphic, promo-graphic, screenshots, tablet-screenshots, large-tablet-screenshots, tv-banner, tv-screenshots, wear-screenshots, title, short description, detailed description and more. Which you can edit according to your app details and replace them with your resources.

Image by Aman Jham

We can see in the above image clearly how all the resources file is available in play folder on the app level.

Image by Tripple-T

Step 3:

Publish app, Now last and straightforward step to publish app run this :

./gradlew publishProducts

or To find more tasks for publishing apps on the test or internal build, you can check out more from here. GPP

If you like this post. Please show support by clicking clap.

Connect with me for a more upcoming post:

Check out this Github repo to understand more about Gradle Play Publisher.

Android Developer, Freelance, Enthusiastic Learner