Making Camera Uploads for Android Faster and More Reliable
Article Summary
Dropbox rewrote their Android camera uploads feature from scratch. It took 2 engineers 2 full years, but first-time uploads now finish 4x faster.
The original camera uploads feature ran on shared C++ code between iOS and Android. After 5+ years in production, it struggled with Android's background restrictions and had grown too risky to maintain. The team rebuilt it in Kotlin with platform-native tools.
Key Takeaways
- Parallel uploads replaced sequential processing using Kotlin coroutines
- Dynamic memory management prevents crashes on older devices
- State transition validation caught duplicate upload bugs early
- Months-long beta rollout with weekly releases caught issues before wide launch
- Error rates dropped while upload performance greatly improved
The rewrite delivered immediate reliability gains and positioned the team to iterate faster as Android continues evolving.
About This Article
Dropbox's C++ camera uploads had a rare hashing bug. The Kotlin and C++ implementations disagreed on photo hashes about 0.005% of the time, which could cause duplicate uploads or missed photos when de-duplication failed.
The team ran the Kotlin hashing code alongside C++ in production. They compared the outputs and checked server rejection logs to figure out which implementation was actually correct before rolling out the full deployment.
The validation process showed that the C++ hashes were wrong and uncovered a bug nobody had caught before. This gave the team confidence that the new Kotlin implementation was correct before they released it.