Name your .apk and .aab files

Tram Ho

This article will explore how to rename your artifacts, to convey meaning.


Use cases:

  1. When your application has different “flavors”, you need identifiable outputs.
  2. When you produce multiple versions at the same time, you need to tell which artifact it is.

To check your current artifact name, simply run the Gradle task, assembleDebug . If you haven’t modified it, your output will be app-debug.apk

It is better to have a more informative and meaningful name, such as the following:

The above sample will create a name like:

By using this template, you know what this APK is.

Option 1

You can find this naming in many answers on StackOverflow.

DSL version:

This works well for APKs but not for app bundles.


Option 2

The following implementation is easy and simple, but as the attribute of “archivesBaseName”, it will only set the base name, not the full file name.

DSL version:


The “-release” section is added automatically.

Compare performance

In this section, Option 1 will be compared to Option 2.

The following metrics are implemented on a 7-module project by running the following tasks:

  • clean
  • assembleDebug
RunsOption 1Option 2

Compare 2 options


As you can see from the charts and figures above, the two options have identical performance, the difference is not obvious.

Remember: When naming your artifacts, make sure you are giving them meaningful names.


Chia sẻ bài viết ngay

Nguồn bài viết : Viblo