Android Build Acceleration: From Gradle Tuning to AAR and Remote Cache, Plus a Tool That Bypasses Gradle
A developer stuck with multi-minute builds loses hours every week and abandons iterative debugging. The concrete tuning here—KSP over KAPT, locked Debug version codes, remote cache, and AAR for stable modules—directly cuts that wait without rewriting the project, and the jugg plugin shows an escape hatch for the worst monoliths.
Android builds waste minutes in three stages: initialization and configuration, compilation and resource processing, and packaging and deployment. The fix isn't copying a few lines of config; it's locating the slow step first, then applying the matching optimization.
Four acceleration categories span the cost spectrum. Zero-cost Gradle settings like parallelism, configuration cache, and KSP over KAPT help every project. Medium and large teams benefit from remote build caches and AAR-ifying stable base libraries, so a full build runs once on CI and everyone downloads the outputs. Architecture-level fixes—using `implementation` over `api`, non-transitive R classes, and shell apps—cut the cascade of recompilations in mature codebases. For daily debugging, IDE-native Apply Changes and cross-platform hot reload skip full repackaging.
For million-line monoliths, Tencent Music's jugg plugin goes further: it reuses the last complete Gradle build as a baseline, compiles only changed files with javac/kotlinc, uses a custom aapt2 for incremental resource linking, and applies changes via JVMTI and reflection—typically within 3 seconds, no build script changes required.
The article's emphasis on locking Debug versions and timestamps is not a minor optimization; it's the condition that makes remote build cache viable. Without stable task inputs, hashing breaks and the cache is useless.
The four acceleration tiers are cumulative, not independent. A small project can stop at Gradle flags, but a large team only gets full benefit when it combines remote cache, AAR binaryization, and dependency governance.
Bypassing Gradle entirely, as jugg does, signals that Gradle's task graph itself is a bottleneck for incremental compilation in huge monoliths. The tool is a pragmatic stopgap for projects that can't modularize yet.
The move to KSP over KAPT is repeatedly cited across Android communities as the single most impactful change for Kotlin build speed, and this guide ranks it as a zero-cost baseline step, reinforcing that it should be universal.
The article's suggestion to use a shell app for single-module debugging reflects a trade-off between artifact complexity and iteration speed; for high-frequency feature work, the extra infrastructure pays for itself.