Android Build Hacks #2 — build time optimization

Some guy tuning or fixing the crane (crane as a building tool metaphor :-) )


Gradle Build Running


Limiting your build

Limiting resources for dev builds

Compiler options

Disable tools for development build

Use instant run

- adding, changing, or removing annotation, class field, static field, static method or method signature- inheritance changes- change of implemented interfaces- element order in layouts that use dynamic ID
- changes are made in app manifest
- there are changes in resources linked in app manifest
- system UI elements are changed, like widgets or notifications
Static build version for development

Other build boosters

Predexing libraries makes incremental builds faster

Disable unneeded tools

Disable tools for debug builds
Disable Crashlytics for debug builds

Don’t use dynamic dependency versions

Gradle properties build time boosters

Profile your build

Gradle profiler output
Console output with information why task was started by Gradle

Gradle scripts

Bad Gradle task
Better Gradle task


Android Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store