How Youku Cut Android Build Times by Up to 35 Minutes: A Deep Dive
Facing build times of up to 35 minutes for Android release packages, Youku’s engineering team applied data‑driven metrics, software and hardware optimizations—including Atlas removal, Gradle and AGP upgrades, DX tuning, redundant task cleanup, and pipeline redesign—cutting debug builds by minutes and release builds by tens of seconds.
Background
Android projects typically use Gradle for building, but its slow execution has long been a pain point. At Youku, the rapid growth of features and codebase caused full‑package build times to reach 35 minutes, severely impacting integration and iteration efficiency.
Metrics and Goals
The team defined core metrics—build duration, failure rate, and hourly build count—to evaluate optimization impact. Monitoring showed high‑cost tasks and unreasonable build configurations as the main culprits.
Optimization Strategy
The effort was split into three dimensions: data‑metric definition, technical optimization (software + hardware), and result preservation.
Software Optimizations
Remove Atlas framework from the build side, eliminating its complex build steps and reducing debug build time by ~3 minutes and release build time by 4‑5 minutes.
Upgrade Gradle (4.4 → 5.5) and Android Gradle Plugin (3.0.1 → 3.4.3). Benefits came from newer AAPT2/ProGuard, better task parallelism, and asynchronous configuration loading, shaving ~2 minutes from debug builds and ~4 minutes from release builds.
DX build tuning: set
android.dexingNumberOfBuckets=16</code><code>android.dexingWriteBuffer.size=256</code><code>android.dexingReadBuffer.size=256to increase cache size and reduce I/O, cutting both debug and release builds by ~3 minutes.
Eliminate redundant tasks (e.g., postPackageDebug, remoteSignAppDebug, DexCountDebug, etc.) to avoid unnecessary APK unpack‑pack cycles, saving 15 seconds to 20 seconds per build.
Hardware Optimizations
Performance profiling with iostat and tsar revealed severe CPU I/O‑wait during builds. Switching from mechanical disks to SSDs reduced I/O bottlenecks, cutting debug build time by ~5 minutes and release build time by ~10 minutes across various machine groups.
Pipeline Redesign
By consolidating post‑processing steps into a low‑copy, single‑extract‑single‑compress pipeline, the team reduced APK handling overhead, achieving an additional ~21 seconds for debug and ~11 seconds for release builds.
Results
Combined optimizations lowered Android debug build time from 12 minutes to 2.5 minutes and release build time from 35 minutes to 12 minutes. Additional fine‑tuning yielded further reductions of seconds to minutes across various stages.
Future Work
Control and clean ProGuard/R8 rules to avoid unnecessary obfuscation overhead.
Address code‑base decay by removing dead code and improving modularity.
Further R8 optimizations once upstream bugs are resolved.
The Youku team will continue to monitor and improve build performance, inviting community feedback.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
