Skip to content
Home » Android » How to Back up Android Apps and Data via ADB

How to Back up Android Apps and Data via ADB

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. 

  1. Download and set up ADB and Fastboot tools on your computer.
  2. 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. enable usb debugging on samsung devices
  3. 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.
  4. Now connect your device to your PC via a USB Cable.
  5. Open the ‘platform-tools‘ folder and type ‘powershell‘ or ‘cmd‘ in the address bar and hit Enter to launch a command window.launch powershell in android platform tools folder
  6. 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
  7. Check your phone’s screen and authorize ADB debugging when prompted. authorize adb debugging on android
  8. You’ll see the serial number of your device in the command window.adb devices command in windows powershell
  9. 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

    adb command to create a full backup of android data

  10. 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. create full back up of android apps and data
  11. The backup file will be saved to the ‘platform-tools‘ folder as ‘backup-.ab‘.app data backup file saved to the adb folder

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>

back up single app with data with adb command

To back up two or multiple apps at once, use the following command.

adb backup -f  -apk <package-name> <package-name>

adb command to back up multiple apps

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

  1. Launch a PowerShell or Command Prompt window from the ‘platform-tools‘ folder.
  2. Ensure that USB Debugging is enabled on your device and the backup file is present in the ‘platform-tools’ folder.
  3. Now enter the below command to restore a backed-up file:

    adb.exe restore ./backup.ab
    

    adb command to restore apps data backup

  4. 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. restore data prompt on android
  5. 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.
  6. 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.

Read Next: 4 Methods to Debloat Android without Root

Rakesh Shukla

Rakesh Shukla

Rakesh is a geek by heart with an ardent passion for all things tech. From a young age, he was drawn to the world of technology and found himself constantly tinkering with gadgets and devices. He enjoys learning and discovering the newest trends in the world of Android, iOS, and Windows.View Author posts