2013-03-31

How to download all .apk files from an Android device to the computer

This blog post explains how to download all .apk files (application software package installers) from an Android device (phone, tablet, etc.) to your computer. The steps described here work even if the device is not rooted.

Prerequisites:

  • You have a computer running Mac OS X or Linux. It's possible to do it on Windows as well, but this blog post doesn't explain how.
  • You have a USB cable with which you can connect the device to the computer.
  • USB debugging has been enabled on the device. You can enable it in the Settings / Development menu. If you can't see that menu, then go to Settings / About... / Build number, and tap on it quickly 10 times in a row.
  1. Install the adb command-line tool. It's part of the Platform SDK Tools SDK package. First download the Android SDK, then run the tools/android GUI tool, select Platform SDK Tools and install. The adb binary will be downloaded to platform-tools/adb .
  2. If you have a new Android (4.2.2 or later) and an old adb binary (earlier than 1.0.31), then it won't work until you install a newer adb binary.
  3. On Linux, follow these steps to make sure that your user has the permission to access the device.
  4. Don't connect your device yet to the computer via USB.
  5. Run adb devices and verify that it doesn't see the device.
  6. If not enabled yet, enable USB debugging on the device (see in the prerequisites section).
  7. Connect the device to your computer using an USB cable.
  8. Run adb devices and verify that it sees your device.
  9. On the computer, open a terminal window, and cd to the target directory.
  10. Run this command in the terminal window: adb shell pm list packages -f >apks.lst
  11. Run this command in the terminal window: <apks.lst perl -ne 'print"$1\n"if m@^package:(/[^=]+[.]apk)=@' | while read F; do echo "${F##*/}"; adb pull "$F"; done
  12. Wait for a few minutes until the command above finishes copying all the .apk files.