📚 Encyclopedia

Android · updated 2026-10-13

Debug installs wipe app data, and recovering it with Android Auto Backup

androidflutter-runsigningauto-backupdata-lossincidentadb

flutter run (or adb install of a debug build) onto a phone that has the release app installed hits INSTALL_FAILED_UPDATE_INCOMPATIBLE, because the debug signature differs. Flutter's helpful response is "Uninstalling old version..." followed by a reinstall, which deletes all app data, SharedPreferences included. For an E2E-encrypted app whose only copy of a private key lives in those prefs, that is unrecoverable message loss. It happened on 2026-07-01 to Justin's daily phone; the data came back only because Android Auto Backup had a copy.

Rules

  1. Never flutter run or adb-install onto any physical device until its owner confirms it holds no data they care about. Ask every time. "The phone that is plugged in" is not "the test phone".
  2. In-place updates with the same release signature are safe; a debug build over a release app is not. Test with a release APK update, an emulator, or a genuinely disposable device.
  3. For changes touching keys, credentials or local persistence, deploy the data-safety part to production before device testing, so a backup path exists before anything can go wrong.
  4. Treat every device as production data until proven otherwise.

Recovery with Android Auto Backup

If the manifest does not set android:allowBackup, it defaults to true, and Android periodically backs up the app's data (including SharedPreferences) to the user's Google account, per signing identity. The debug build's data was stored separately and did not overwrite the release app's backup. Steps that worked: 1. Put the phone in airplane mode immediately, so a fresh backup of the now-empty app does not overwrite the good cloud copy. 2. Check Settings > Google > Backup for a recent backup. 3. Uninstall the debug app and install the release APK (same signing key as the backup). On first launch Android restores the backup automatically. 4. Update in place to the fixed build and make sure the data now also lives somewhere durable (here: log out and in once so the key was archived server-side, then verify on the server).

Keep allowBackup on for apps whose local state matters, unless you have a better backup story.

Diagnosing whether a key was really lost

See also

Linked from

Sources: tldr memory (feedback_never_debug_install_real_device, incident-dm-key-wipe-recovery), 2026-07-01 incident