Introduction to Android adb tool

This is a migrated post from my former blog.

Adb (Android Debug Bridge) is a command-line tool that allows you to achieve some operations over a real or emulated device connected to your computer. You can find it in <android-sdk>/platform-tools.

If you haven’t the Android SDK, visit the official site to download it.


Some useful examples

An interesting use of adb is to know how many devices are currently connected to your computer:

adb devices

The next one allows you to install an app:

adb install <path to .apk file>

You could reinstall it withouth deleting previous user data:

adb install -r <path to .apk file>

Or install it on SD storage:

adb install -s <path to .apk file>


Device shell

With adb shell you can access to the device management console and once you’re into it, for example, you could change the device/emulator language:

setprop persist.sys.language en;
setprop GB;
sleep 5;

The next option will be very useful if you’re running out of device internal storage, since it forces the installation of any app on the SD:

adb shell pm setInstallLocation 2

Available alternatives are:

  • 0 - Automatic location (default)
  • 1 - Internal storage
  • 2 - SD storage