Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I would like to ask if it possible to backup and restore all Android Settings and applications through ADB.

I tried:

adb backup -all
adb: unable to connect for backup

It is not working, while all other commands are working.

Is it possible to use this bmgr ?

share|improve this question

migrated from stackoverflow.com May 23 '12 at 20:14

This question came from our site for professional and enthusiast programmers.

    
i am using adb 1.0.29 on win7-64 and get the error adb: unable to open file ./backup.ab when executing adb backup -all. does adb devices find your android? –  k3b Jan 17 '12 at 19:42
    
yes I can see the device id. –  salamis Jan 17 '12 at 19:53

6 Answers 6

Make sure debugging is enabled and the device is connected. Also, remember to actually select the "backup my data" button on the device itself (the device requires confirmation). If you don't see such a screen on your device, you're quite possibly running a pre-ICS (< 4.0) phone, which will unfortunately will not have the feature.

Also, bmgr is not a solution for this- It's a tool for testing apps that handle their own backups using the backup API by manually firing the "backup" and "restore" methods on the backup agent in the application, not shelling into the device and copying data to/from the development machine.

share|improve this answer

Here is my command for backing things up

./adb shell ls -l -a | grep '^[^l]' | sed -e 's/^d.* \([^ ]*\)\r$/mkdir sav\/\1; .\/adb pull \/\1 sav\/\1/' -e 's/-.* \([^ ]*\)\r$/.\/adb pull \/\1 sav\/\1/' | /bin/bash
  1. list all files
  2. ignore links
  3. for
    • files : output an adb pull command
    • directories : make the dir (in case we pull sth empty) and output an adb pull command
  4. execute everything in bash

There are some files where I get a permission denied - but as this backup is made in order to root the device, I can not get more permissions :(

share|improve this answer
1  
This indeed appears to backup all files (minus the "permission denied" bits) even on older Androids (in this case, Gingerbread 2.3.3). I use this variant (added -p param to mkdir to avoid some error messages and removed ./ in front of ./adb): time adb shell ls -l -a | grep '^[^l]' | sed -e 's/^d.* \([^ ]*\)\r$/mkdir -p sav\/\1; adb pull \/\1 sav\/\1/' -e 's/-.* \([^ ]*\)\r$/adb pull \/\1 sav\/\1/' | /bin/bash –  Stéphane Gourichon Nov 6 '13 at 7:53

If I understand you correctly, this link might be what you are looking for. To summarize:

1) Run adb devices to make sure your device is attached.

2) Run adb pull /data/app ./ to grab all the app APKs and put them in the current folder.
a) Or Run adb pull /system/sd/app ./ to get apps on the SD card.

3) Settings are located in various places, so find out where and then use the same adb pull command to grab them.

And then the link details how to restore based on Mac or Windows.

Alternatively, it looks like the bmgr command you mentioned would also work with a few simple commands (adb shell bmgr backup <package> to backup and adb shell bmgr restore <package> to restore). What more are you looking for?

share|improve this answer
    
As Alexander Lucas notes in his answer below, the bmgr command is a tool for developers to test app backup/restore. It does not actually copy any data off the device, so its unlikely to be useful. –  P.T. Oct 3 '12 at 3:16
    
Doesn't work on adb 1.0.30 with Gingerbread device: pull: building file list... 0 files pulled. 0 files skipped. –  Stéphane Gourichon Nov 6 '13 at 7:54

Make sure to run the SDK update and specifically check the box for Google USB Drivers and update the SDK.

After enabling USB debugging on your device and plugging into your PC, you should get a prompt about installing drivers. Even if its successful open device manager and find your phone, right click and update drivers and point it to the Google USB driver folder in the SDK > Extras > Google USB and let it update the drivers.

Then you should be able to pull full backups off your device.

share|improve this answer
    
This fixed the issue for me when I was having it. The drivers were not the issue, but the ADB version itself was too outdated. –  AJ Henderson Jul 21 at 14:27

I had the same issue and am also pre-ICS. What I did to work around it was used an ls of / and awk (with grep to skip links) to create a batch file that pulls each actual directory onto a directory on my PC.

share|improve this answer

problem is probably due to more than one device/emulator connected.

check adb devices if it shows more than one device then it might not be able to connect specialy to emulators.

run adb usb it will restart other devices, then disconnect/reconncet usb cable, now run

adb devices

it should show only one device.

now do

adb backup -all

and you should be good to go :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.