Member-only story

Android, better build time

Rodrigo Martins
7 min readOct 16, 2022

--

How to improve your Android project build time

Hi, today I’ll share about the process that we used to improve the build time of the project that I’m currently working, from 6–8 minutes to 3–5 minutes. The build time depends on several variables, so we can not define an exactly number. The progress so far is not too much but, we have a lot to do and 2 minutes per build in a day make some difference later.

Before we start, keep in mind that every project is different and has his own particularities, so maybe, what we did here will not work for you. You need to study your project and check what will make sense to do or not.

I like to work with these optimizations because, I can see with time things getting better, and build time is something really important on a developer routine, if you have to wait 8 minutes to see a layout change, this is awful. So take some time, and a step back in your project and improve it, it is not ok to be frustrated with your work for things like this.

Tool

First, you need to install the gradle-profiler tool, we will use it to measure the build time of the project, you can also use the Gradle — scan command, but I like the Gradle profiler because he offers more features, with the advanced profiling scenarios.

I use the following command to trigger the build profile. You need to create a file on the root of the project called performance.scenarios.

gradle-profiler — benchmark —…

--

--

Rodrigo Martins
Rodrigo Martins

Written by Rodrigo Martins

Be brave and boldly go where no man has gone before. Let's discover the future!

Responses (2)