ADB is a CLI tool for Android that lets you perform basic and advanced tasks. You can also use commands to back up your phone’s apps and data. It is always recommended to have a complete backup of your Android device. It becomes even more important if you are into tinkering with your phone and tweaking your device’s software. And you might very well know that your Android device already has a built-in backup system in place. In this tutorial, we’ll explore how to create a backup of Android apps and their data and restore them using ADB commands.
Normal backup and data syncing methods require an active internet connection. The same goes for restoring the backed-up data. With ADB, you can create a backup of apps and their associated data using commands. The best part about this tweak is that you don’t need a rooted device. Let’s now see how to do this.
Please note that the adb backup
command works only for those apps that allow backup. If the app’s AndroidManifest.xml
 has the allowBackup=false
declaration, you can’t back up its data using ADB.
Backing up Apps and Data via ADB
Before beginning with the steps, download and set up the Android SDK and Platform Tools on your PC and enable USB Debugging on your device. Then only you could begin with backing up the apps and data using ADB. Refer to the below steps.Â
- Download and set up ADB and Fastboot tools on your computer.
- Now, navigate to Settings > About phone > Software information and tap on Build number 7 times to unlock Developer options. Then go back to the Settings > Developer options and tap the slider icon next to USB Debugging.
- Please note that your phone’s screen is not locked while sending commands from the computer. To ensure this, go to Settings > Display > Screen timeout and set it to 5 or 10 minutes.
- Now connect your device to your PC via a USB Cable.
- Open the ‘platform-tools‘ folder, type ‘powershell‘ or ‘cmd‘ in the address bar, and hit Enter to launch a command window.
- It’s time to verify that your phone and computer are connected properly and ADB can detect your device. Use the following command to do that.
adb devices
- Check your phone’s screen and authorize ADB debugging when prompted.
- You’ll see the serial number of your device in the command window.
- Now you are all set to use ADB commands to back up Android apps and data. Use the following command to back up all apps and their data. “Backup.ab” is the name of the backup file where “backup” can be changed while “ab” is an extension meaning ‘Android Backup’.
adb.exe backup -apk -shared -all -f ./backup.ab
- Enter a password on the Full backup prompt screen if you want to encrypt the backup file. Otherwise, tap Back up my data to proceed.
- The backup file will be saved to the ‘platform-tools‘ folder as ‘backup-.ab‘.
You can also use the following commands to create a full backup.
adb backup -f all -all -apk -nosystem
If the adb backup command empty files, no prompts
adb shell 'bu backup -apk -all -nosystem' > backup.adb
Similarly, you can back up individual apps with APK and data. There are 4 methods to find the package name of Android apps.
adb backup -f -apk <package-name>
To back up two or multiple apps at once, use the following command.
adb backup -f -apk <package-name> <package-name>
Now that you have created a backup, you can easily restore the same when needed. the steps will again be carried out via ADB commands. Refer to the below steps to know more.
Restoring Backup via ADB
- Launch a PowerShell or Command Prompt window from the ‘platform-tools‘ folder.
- Ensure that USB Debugging is enabled on your device and the backup file is in the ‘platform-tools’ folder.
- Now enter the below command to restore a backed-up file:
adb.exe restore ./backup.ab
- A Full Restoration menu will appear on your device. If the file is encrypted, enter the password to decrypt it before starting the restoration process. Once done, tap the Restore my data.
- That’s it. This process of data restoration is now over. It may take some time to complete depending on the size of your backup file.
- If the above command doesn’t work for you, try the following:
adb shell 'bu restore' < backup.adb
And with that, we conclude this guide on creating a backup of apps and their data via ADB commands. We would love to hear your views on this article. Do drop them in the comments section below.