Backup & Restore Android Apps Using ADB

Android is an interesting platform for a number of reasons, one of which is it’s openness to developer and debugging tools, and the fact that it runs a modified form of Linux as an operating system. If you’re like me and quite fond of jumping around from ROM to ROM on your Android devices, a quick and easy way to backup your program files (and even settings) is quite desirable. Here’s my solution, hopefully it will help you. I know there are easier ways, but for a diehard geek who has the setup ready, this is the fastest way.

First step: Install Android Debug Bridge (adb)

adb is a tool found in the Android SDK, which you can download here. Once you unzip the SDK, add the directory to your path so you can call adb.exe from the command line (or just always run it from it’s tools directory). Once the SDK is installed, you can connect your device to your computer and make sure you SKIP the driver detection Windows automatically starts. If you don’t, Windows will install a generic USB device driver and adb won’t work. If you accidentally do this, follow the steps outlined here to fix the problem. You may want to use pstools to run Registry Editor as System to fully delete out the entries that the fix tells you to delete, otherwise it’s a long process of taking ownership of directories, giving yourself permission, and finally deleting the directory. Repeat 15 times. Sounds like fun right?

So how do you know you have adb installed and working? Well if you plug in your device and run the following command:

adb devices

and you get back something that looks like this:

List of devices attached

HT845GZ67642 device

then it’s working. If you get a message saying that no devices were found, then it isn’t!

Second step: Backup the applications (and settings)

Now that you have adb working, open a command line and make a new directory. To backup the apk files (The package files that store the program’s executables and libraries), run the following command:

adb pull /data/app ./

and you should see a long list of apk files being downloaded to your computer. UPDATE: if you’re using a ROM that places your applications on the SD card for speed and backup purposes, the above command won’t work. Instead use the following command:

adb pull /system/sd/app ./

Settings are a slightly different beast. They’re stored under /data/data on the device, and you may have to hunt around a bit to find what you’re looking for. running the following command will let you access your phone in the same way you’d SSH into a unix/linux machine, or work at the Mac command prompt:

adb shell

Some examples are below of often-backed-up files you may want to grab off your device:

MMS/SMS data: /data/data/com.android.providers.telephony/databases/mmssms.db

Browser settings: /data/data/com.android/browser

System WiFi Settings: /data/misc/wifi

Once you have everything you want backed up, it’s time to restore!

Third step: Restoring data

Assuming you want to restore APK files, and you have all of those in 1 directory, you can run the following command on a mac to install all those apk files:

find ./ –exec adb install {} \;

If you’re on a Windows machine, your command is a bit longer, and this assuems your apk files are in c:\backupapps

for %%f in (“C:\BackupApps\*.apk”) do adb install “%%f”

Alternatively, from a command line window in the directory you have your backed up apps, you can run the following on a Windows machine:

adb install *.apk

After the applications, you can restore whatever data files and settings you backed up. Oh, and for you apps2SD users that may have a really bloated extended partition and want to wipe clean, try the following to clear the EXT partition on your SD card so you can move new apps over (useful for those who are doing completely clean installs on SD cards that were previously used with apps2SD). You should do this from the Recovery image, not the actual live running version (e.g. reboot and hold Home to get to recovery image.)

mount /system/sd
rm -rf /system/sd/*

Hopefully this little walk-through was somewhat helpful for you! If so, leave a comment!

Jon’s Gadget Bag

What Lies In The Bags Of A Geek?
My gadget bag is very full when I pack it up with all my gear.  Here are the stats on what I use, and what I think of it!
The Bag: A
Roadwired MegaMedia Bag (Leather Edition).  Yea, I know, the price is REALLY steep on this one.  Retailing for $179 for the nylon version, and $249 for the leather, cheap old Jon bought the bag Used on eBay for $70 or so.  That being said, this bag simply kicks ***.  Pockets for everything, a nice feel, not too heavy, not too light.  It’s a perfect overnight bag, daily driver, etc..  I only buy bags from 2 companies: Roadwired & Targus.  Why? They have lifetime warrenties.  A must if you’re on-the-go.  I also alternate between this bag and a Targus Matrix bac
kpack depending on where I’m going, what I’m doing, etc…  I also have a Roadwired Podzilla for camera trips or day long techie outings.
The Computer: An Acer Travelmate C110 Tablet-PC Convertible is my trusty travelling companion.  I’m very happy with it, it’s small, and it has Bluetooth and WiFi built in.  I also have a Compaq Evo n800c that used to be my travelling system, but it’s lately been my home system.  It’s nicely docked in my make-shift server cabinent.
The Pocket PC’s: Currently I own a i-mate K-JAM
.  My heavy lifing machine is a borrowed i-mate JasJar , which I love!  I’ve set up an additional blog entry for my Pocket PC software titles, available here (Once written).  I recently sold my Dell Axim x50v & an HP iPAQ h6315
The MP3 Player: For my birthday I bought myself a 60gb iPod Video, which stores all my media (Music, Pictures, Video) and if I don’t take that along for music, I usually use my Pocket PCs for my MP3 listening. I used to use a
Creative Nomad Jukebox 3  I’m one of those people who have always liked the Nomad Jukebox’s look (like an average CD Player) and massive HD size.  It backs up all of my music files and is portable enough to take with me in the car or on frequent grass cutting trips. As a plus, you can leave it out in your car without really worrying about someone stealing it, since it looks like a $20 CD player (Although I don’t leave any of my babies out, even if they are inside my always-locked Caddy…) The Nomad now lives at my mother’s house so she can listen to music.
The Headphones:
rget=_blank>Bluetake iPHONO Bluetooth Headphone Kit. While these headphones have a few shortcomings (i.e. the range is kinda restricted when you’re moving around with them, and my head is a bit too big for them), once I’m on my way with them comfortably in place, they are worth the price.  Given to me as a gift, my i-PHONOs are always on me when I conduct Lawn Wars (i.e. the cutting of the grass), connected to my Nomad above.  As a plus, they can also be used as a BT headset!

The Bluetooth Headsets: Jabra BT800, Jabra BT250 (Retired),

Motorola Bluetooth Speaker (Special Use – Car Visor Clip On):  The Jabra is my daily headset, with the motorola along for long car rides or trips (It comes with a nice cover that can clip onto a visor).  The nice thing about these three is the battery life.  Previously I had other BT headsets that lasted 1 – 2 hours MAX (Which didn’t work when I used to call Karey all the time for 3 – 4 hours a night….).  These are charged once a week or so, and I never have to worry about
them.  Simple, Reliable, just like they should be.
Mobile Peripherals:
ThinkOutside Bluetooth Mouse & Keyboard This nice pair, which I don’t use all that often, work nicely with all my PPCs and my Tablet PC.  For mobile typing / mousing, they are the best I’ve ever used.  The prices on their website is a bit misleading – you can grab these gems for around $70 (the keyboard) and $40 (The mouse) on other sites (I got mine on Amazon).