Glovo's Essential Tips to Minimize Gradle Build Time (Part II of II)
Original post Accelerate Your Android Development: Essential Tips to Minimize Gradle Build Time (Part II of II)
Article Summary
Rolgalan from Glovo's Mobile Platform team reveals how they slashed Android build times through hardware and JVM tuning. Most teams are leaving massive performance gains on the table by ignoring these fundamentals.
This is Part II of a deep dive into Gradle build optimization, focusing on hardware configuration, JVM memory settings, and lesser-known tweaks. Glovo's team shares battle-tested strategies from optimizing builds for both CI/CD pipelines and local development across their mobile apps.
Key Takeaways
- Switching from Fargate to EC2 with wrong disk caused 3x slower cache reuse
- Default 512MB heap is too small: tune Xmx, Xms, and separate Kotlin daemon memory
- Test workers spawn per core: 16 cores can consume 16GB RAM simultaneously
- Dagger finally supports KSP over KAPT for dramatically faster annotation processing
- Different garbage collectors showed 35min vs 60min+ builds on identical hardware
Hardware specs (especially NVMe disks and core count) and JVM memory configuration are the most impactful optimizations after implementing caching and parallelization.
Continue reading
What This Article Covers
Glovo's engineers dealt with unpredictable build delays of several minutes. Dependencies needed to download during builds, and network variability made build times inconsistent between local machines and CI environments.
The team pre-cached dependencies, Gradle, Android SDK tools, and Robolectric system images on CI agents. They used GitHub Actions' gradle-build-action, which automatically caches compiled build scripts and the ~/.gradle folder.
With downloads eliminated and cached build artifacts in place, build times became consistent and reproducible. The multi-minute network overhead that slowed incremental builds disappeared.
This page summarizes “Accelerate Your Android Development: Essential Tips to Minimize Gradle Build Time (Part II of II)” by Glovo, published Nov 6, 2023. All credit for the original work goes to the authors.