Moving an app’s private data—settings, login tokens, saved games—from an old Android phone to a new one is a frequent pain point. Google’s cloud sync works for many apps, but not all, and some data simply isn’t backed up to your Google account. Fortunately, the Android Debug Bridge (ADB) provides a built‑in, no‑root way to create a full backup of an app (or a group of apps) on one device and restore it on another.
After reading this guide you will be able to:
The method works on Android 4.4 (KitKat) through Android 12, but there are version‑specific quirks that we’ll cover.
Prerequisites
Important warning: The backup will contain any personal data stored by the app (e.g., messages, credentials). Treat the .ab file like a sensitive document—store it in an encrypted folder or delete it after the restore.
ADB’s backup command creates a single .ab file that can include:
-apk flag).-shared for shared storage, -all for all apps).-encrypt flag.When you run restore on the target device, the package manager reinstalls the APK (if you included it) and writes the saved data into the app’s private directory. The process respects the app’s android:allowBackup manifest attribute; if the developer set this to false, ADB cannot back up that app’s data.
Download the platform‑tools zip for your OS, extract it to a convenient folder (e.g., C:\adb or ~/adb), and add that folder to your system PATH so you can run adb from any terminal.
Verification: Open a command prompt or terminal and type adb version. You should see something like Android Debug Bridge version 1.0.41.
On Android 12+ you may also need to enable “USB debugging (Security settings)” if you plan to back up apps that store credentials in the keystore.
adb devices. You should see a line like 0123456789ABCDEF device.unauthorized, look at the phone’s screen and tap Allow on the RSA key prompt.Once the device shows as device, you’re ready to start the backup.
Run the following command to list all installable packages that allow backup:
adb shell pm list packages -f | grep -i "allowBackup=true"
Unfortunately there is no direct ADB flag to filter by allowBackup, so the above command is a quick way to see which packages are likely to work. In practice you can simply try the backup; if the app blocks it you’ll get a warning during the process.
For this tutorial we’ll assume you want to move the data of a single app, e.g., com.example.game. Replace that package name with the one you need.
~/android_backups.adb backup -apk -shared -f game_backup.ab com.example.game
-apk includes the app’s APK so you don’t need to reinstall it on the target.-shared adds any files the app stored on shared storage (photos, downloads).-f specifies the output file name.What you should see: A progress bar on the phone and a new game_backup.ab file in the folder you chose on the PC.
You have three safe options:
scp if both machines are on the same network.Make sure the file ends up in a location you can easily navigate to from a terminal on the target PC (or on the same PC if you plan to use ADB over Wi‑Fi).
adb devices that it appears as device.-apk flag, you can skip reinstalling the app. If you omitted it, install the app from Play Store or an APK first.adb restore -f game_backup.ab
(The -f flag is optional; ADB will read the file you specify.)
Verification: Open the app on the target phone. It should open exactly where you left off on the source device—same login, same saved progress, same settings.
Depending on what you need, you can tweak the backup command:
adb backup -apk -nosystem -f all_backup.ab -all – backs up every user‑installed app (excluding system apps). Useful when moving to a brand‑new phone.adb backup -f mydata.ab -shared – backs up only files on shared storage (photos, downloads). Does not touch private app data.adb backup -f encrypted.ab -encrypt – prompts for a password and encrypts the entire file on the fly.Remember that -all will attempt to back up every app that allows it; some large games may produce multi‑gigabyte backups.
adb backup for apps that target API 28+ and have android:fullBackupContent set to @xml/backup_rules that exclude data. In practice many popular apps still allow backup, but if you see a warning like “Backup failed for com.example.app”, the app simply does not expose its data to ADB.Problem: “Backup failed: com.example.app (error 2)”
Cause: The app has android:allowBackup="false" or uses a protected keystore.
Solution: Verify the app’s manifest (if you have the APK) or check the developer’s FAQ. If the data is essential, look for an in‑app export feature instead.
Problem: “adb: command not found”
Cause: ADB is not on your system PATH.
Solution: Add the platform‑tools folder to PATH or call it with the full path, e.g., ~/adb/adb devices.
Problem: Phone disconnects during backup, leaving a truncated .ab file.
Cause: Loose USB cable or power‑saving mode.
Solution: Use a high‑quality cable, disable “USB selective suspend” (Windows) or “USB configuration → Charging only” (Android), and keep the phone awake (enable “Stay awake while charging” in Developer options).
Problem: Restore asks for a password you don’t remember.
Cause: You set a password during backup but forgot it.
Solution: Unfortunately ADB cannot recover a lost password. Delete the backup and create a new one without a password, or use a third‑party tool to brute‑force (not recommended).
.ab file on a shared or public computer without encryption.-encrypt flag, choose a strong password (minimum 12 characters, mix of letters, numbers, symbols).shred -u game_backup.ab on Linux or use a reputable file‑shredder on Windows).adb tcpip 5555
adb connect 192.168.1.42
Replace the IP with your device’s address. The rest of the workflow stays the same.
adb backup -shared -f photos_backup.ab com.example.app and restore with adb restore photos_backup.ab. The app’s private data will remain untouched.apps.txt with one package name per line, then run:
while read pkg; do adb backup -apk -shared -f ${pkg}_backup.ab $pkg; done < apps.txt
This automates backups for a list of favorite apps.
android-backup-extractor:
java -jar abe.jar unpack game_backup.ab game_backup.tar
tar -tf game_backup.tar | less
This does not modify the backup; it’s purely for inspection.
If the app you need to migrate does not allow ADB backup, consider these alternatives:
By following the steps above you can confidently move an app’s private data from one Android device to another without rooting, without relying on cloud services, and without reinstalling the app manually. The process is transparent: you see exactly what is being copied, you control encryption, and you keep the backup file in your hands.
Remember to respect the privacy of the data you’re moving—treat the backup file as you would a password manager export. With a little preparation, ADB backup and restore become a reliable part of your Android migration toolkit.









