id: 161 View:category
Tutorials  Build  Gradle
Tutorials  Build  Gradle
The About Process

How about that?

Here's the third in a series covering some handy tools which an Android developer can wire into their build system. Ideally, this would be right when the project is started, but adding to an existing one shouldn't be too difficult either.

This one's focused on something we're all familiar with. Pretty much every app needs some way inside the app to identify itself further to the user, and the usual way is an About box.  A basic one might just show the version number, but more sophisticated ones can vary according to the kind of build it relates to, for example debug or release. There are plenty of other areas it's useful to cover too, for example does this build expire? Where can the user report bugs? Who wrote it? Even functionality, such as a "Rate us" link, can be added as boilerplate then tweaked later. Or your logo, cutely being animated ;-)

When you've done this a few times too many (!) you realise there ought to be a way to automate most of this,  and a skeleton one could be used so the developer can, ahem, flesh out the apps info later with most of the basics being dealt with already.

The source for this project is available on GitHub, and if you just want to run the app, allow unknown sources on your Android device and click here.

Tutorials  Build  Gradle
The Versioning Process

Where did that APK come from?

Welcome to the second in a short series covering how to give the Android build process a little boost from the get-go.

Once an APK is built and distributed, developers know they can kiss goodbye to controlling where it ends up. This can be a problem with testing, maintenance etc, and without further care such as clear versioning identification in the app itself, make tracing bugs harder. For example, if every released APK was just called MyApp.apk, how can you tell the one released this morning from the one released last month?

Versioning systems such as Subversion, Git etc support these id's, so it's possible to match up a particular check in with the files needed to create that APK. 

What's described here is a way to automatically add those version details to the produced APK file itself, so you'll end up with MyApp-debug-beta-1.1.0-368-dev.apk or whatever. The filename comes from a combination of the build variant name, the id in the version system and the source machine (eg. a CI build, or a local developer, "dev") which created it. The example uses subversion as the CM.

This project is available on GitHub.

Tutorials  Build  Gradle
The Signing Process

Release early, release often

This is the first in a short series collecting together a few techniques for enhancing the build process for Android. It's aimed any anyone starting a project who wants a little more productivity than the default startup wizards in Android Studio (3.1) offers.

Sometimes it can be useful to see how release builds measure up early on in a project's development.

This might be to keep an eye on the final APK size, to see what performance is like without the debug code or to make pre-releases available to testers, etc. Android Studio (3.1) does a great job of setting up the builds for new projects in debug, but the variant for release isn't really there from the get-go. This is most likely because everyone's signing process is different.

Sure, when you try to run in release mode you're prompted for all the signing credentials, which is OK for occasional signed builds. However, a solid, repeatable signing system, which works unaltered with automated building tools such as Jenkins, is useful to slot into the dev process early on.

The full project presented here is available on GitHub.

Tutorials  Build  Gradle
Gradle Script Kotlin

Yup - use Kotlin in Gradle Script

As you know, we use Groovy to write our Gradle build scripts and it has pros and cons. Groovy is a dynamic language which means that it’s not statically typed, making difficult to write or modify our gradle scripts without making many mistakes as we don’t have autocomplete there.

Last year, Gradle decided to start using Kotlin to writing Gradle build scripts creating, what they call, Gradle Kotlin Script. The project is moving fast (0.9.0 version at the time of writing this article) but, on the other hand, there is practically no documentation.

So, I want to show you how to use Gradle Kotlin Script to create Gradle build scripts written in Kotlin in one Android project.

Full article