# Enabling R8 optimization at scale with AI-assisted debugging

[Grab](https://yomu.fyi/company/grab) · Nguyen Van Minh · Mar 12, 2026

## Summary

Grab experienced widespread Application Not Responding spikes across its Android superapp, driven by memory pressure and complex Jetpack Compose layouts embedded in legacy code. While switching to advanced R8 optimization promised significant performance gains, obfuscated stack traces and two-hour remote compilation cycles stalled investigation across nine million lines of code. To resolve this, engineers built Model Context Protocol tools to automate APK decompilation, deobfuscation, and code context extraction. The team paired these tools with an AI workflow that used the GitLab CLI to generate multiple solution branches and run verification builds in parallel. This strategy replaced hours of manual reverse engineering with minutes of automated analysis, allowing the team to debug and validate aggressive optimizations at scale.

## Takeaways

- Switching from basic shrinking to proguard-android-optimize.txt introduces method inlining, class merging, constant folding, dead code elimination, and devirtualization.
- Custom Model Context Protocol (MCP) tools automated APK decompilation, stack trace deobfuscation, and code context extraction, reducing hours of manual reverse engineering to minutes.
- Using the GitLab CLI (glab), an AI-assisted workflow generated multiple merge requests to test different fix approaches concurrently, bypassing the bottleneck of sequential two-hour CI build cycles.

**Tags:** [Android](https://yomu.fyi/topic/android), [CI/CD](https://yomu.fyi/topic/ci-cd), [LLMs](https://yomu.fyi/topic/llm), [Performance](https://yomu.fyi/topic/performance)

[Read original post](https://engineering.grab.com/r8-optimization-at-scale-with-ai-assisted-debugging)
