Shipping Two Apps In One Android
Article Summary
Snapchat shipped two complete Android apps in a single APK to A/B test their rewrite. The engineering challenge? Android wasn't designed to support this at all.
When Snapchat rebuilt their Android app from scratch, they faced a critical question: how do you test a complete rewrite without losing the ability to update your production app? Their solution was technically audacious: bundle both the old and new apps together, let users switch between them, and A/B test at scale. They built a library called Stuffing to make it work.
Key Takeaways
- Stuffing library enables multiple isolated Android apps in one APK
- App switching took 10+ seconds on older devices, requiring special UX
- Combined APK added only 25MB and 20ms startup time overhead
- Easter egg on Snap Map near Bermuda let curious users opt in
- Maintained thin Stuffing layer post-launch to handle backwards compatibility
Snapchat open-sourced Stuffing, proving you can ship two apps in one APK for proper A/B testing, though the edge cases around data migration, entry points, and app switching add significant complexity.
About This Article
Snapchat ran into an issue where launcher icons would vanish from the home screen when users switched between app versions. The team had tried disabling manifest components, but that caused the icons to disappear during the transition.
Instead of disabling the original activity, they used Activity Alias to redirect the launcher intent to DynamicLaunchActivity. This kept the launcher icon reference intact.
Users could switch between app versions without losing the app from their home screen. The team was able to run A/B tests without creating a bad experience for people using the app.