A Groovy Script to Save Them All (Android DevLog 4)

Gradle Gradle Gradle

In #3, I talked about user support, but let’s get back into the world of coding and productivity, specifically a gradle task to archive apks and proguard files on build.

Busy Peeps: Here’s the groovy/gradle task

Painful APKs and Keeping Organized

At Pressure Labs we keep an archive of all past apks and proguard maps for just in case.

While I am not proud of, I will still admit that for the longest time, I did this manually 🤢.

But hold on I’m not finished! After seeing the horrible pain this was, I decided to dive into the wonderful world of that weird forgotten build called Gradle.

Under the hood gradle, like any build tool, executes tasks to build your apk. Neat part is you can create your own tasks to run on a command line.

Deploying My Fears Away

With the friendly help of the internet I wrote a a small script for myself called deployApks which has saved me a considerable amount of time.

Add to the bottom of your app/build.gradle

https://gist.github.com/robertsimoes/23e4ae728ef3fd3f924440c059a4b6e1

Android Studio manages build system internally, so I haven’t really attempted to integrate the task into the building and signing process

(edit; Thanks to Manoj Madanmohan for letting us know you can actually intergrate this quite easily!)

However, for the times I update our available apps, this saves me a considerable amount of time in manual manipulation of apk files and folders.

Usage

Build your signed APK via Android Studio

Build > Signed APK > [Enter Your Signing Credentials] > Done

Run ./gradlew deployApks

Magic Happens

And voila!

A a shiny new .admin folder with archived apks, version numbers and mappings! 🎉🎉🎉🎉


Be sure to checkout our app Conscious — Distributing ideas — we’re trying to create an ecosystem for distributing intellectual ideas anonymously!