Android Developers Blog: Mercari reduces 355K lines of code, a 69% difference, by rebuilding with Jetpack Compose
Article Summary
Mercari just deleted 355,000 lines of code from their Android app. And it works better than ever.
When Mercari's 7-year-old codebase became a bottleneck for shipping features, they made a bold call: rewrite the entire Android app from scratch. They chose Jetpack Compose, Android's modern UI toolkit, for their complete rebuild across 130+ screens.
Key Takeaways
- Eliminated 355K lines of code (69% reduction) while maintaining full functionality
- Home screen renders frames up to 2x faster with baseline profiles
- Reduced slow rendering instances by 23.6% using Compose performance tools
- Rewrote 130+ UI screens with new design system fully integrated
- Used AndroidView for drag gestures before Compose APIs were available
Mercari's complete rewrite with Jetpack Compose resulted in 69% less code, 2x faster rendering, and a more maintainable codebase that ships features faster.
About This Article
Early versions of Jetpack Compose didn't have gesture APIs, so Mercari's team had to work around this limitation. They needed to handle drag interactions on their listing form screens where users rearrange photos from their device gallery.
Mercari used Compose's AndroidView to integrate traditional Views for gesture handling on the listing form. This gave them a working solution while they waited for Compose's gesture APIs to mature.
Once Compose's gesture APIs became available, the team rewrote the drag gesture component entirely in Compose. This showed how interoperability between Compose and Views let them keep moving forward without being blocked by missing platform features.