Snapchat Jul 27, 2020

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

Critical Insight

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.

The article reveals how they hid an alpha opt-in easter egg that the Android community discovered in days, plus the tricky backwards compatibility cases that forced them to keep Stuffing even after removing the old app.

About This Article

Problem

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.

Solution

Instead of disabling the original activity, they used Activity Alias to redirect the launcher intent to DynamicLaunchActivity. This kept the launcher icon reference intact.

Impact

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.