Enabling R8 optimization at scale with AI-assisted debugging
Article Summary
Grab's Android team cracked a 6-year problem that stumped multiple attempts: enabling R8 optimization across 9 million lines of code. One engineer led the charge, and AI was the secret weapon.
Grab's superapp was drowning in ANRs (Application Not Responding errors) across all features, pointing to platform-level issues. R8 optimization was the known solution, but previous attempts failed due to debugging complexity, impossible testing requirements, and 2-hour build cycles. This time, they built custom AI tooling to break through.
Key Takeaways
- 25% ANR reduction, 16% smaller app size, 27% faster startup in 10 weeks
- Custom MCP tools auto-decompile obfuscated code and create parallel test branches
- Pattern-based testing strategy: fix one issue, resolve similar problems across codebase
- Remote compilation cut feedback loops from 2 hours to 1 hour
- Only one issue escaped to production despite massive code transformation
One engineer used AI-assisted debugging and pragmatic testing to enable R8 optimization across Grab's 9M+ line Android codebase, delivering major performance wins that eluded teams for 6 years.
About This Article
Grab's 9M+ line Android codebase was hitting high ANR rates across all features. Memory pressure, ad-heavy flows, and a mix of Compose and XML layouts made things worse. R8 optimization was blocked because obfuscated code required hours of manual reverse engineering work for each issue.
Grab built custom MCP tools that automatically decompile APKs and deobfuscate stack traces. They integrated AI with GitLab CLI to create parallel merge requests, testing multiple solution approaches at the same time. This removed the manual reverse engineering bottleneck entirely.
Tasks that used to take hours, like decompilation and deobfuscation, now take minutes. Parallel CI builds test multiple fixes at once instead of one after another. The entire R8 optimization rollout finished in 10 weeks with just one production issue.