ADB Commands — Part I

The Android Debug Bridge also known as adb is powerful tool for the developers.

Besides being the basic tool to deploy the Android applications that you develop it also provides several commands that can be very useful.

Here are some of those commands.

  • If you want to see how many devices/emulators are attached you can do it with:
adb devices

  • Send a file to the device:
adb push /home/myhome/image.png /sdcard/Download/

The first argument after the push command is the local path of the file that is in your computer and that you want to send. The Second argument is the path in the device that you want to store the file.

  • Retrieve a file from the device
adb pull /sdcard/Download/pic.jpg /home/myhome/Desktop/pic.jpg 

The first argument after the pull command is the full path of the file that is stored in your device. The second argument is the full local path in your computer that you want to store the file.

  • Want to reboot your device from the command line ? No problem, just type:
adb reboot 

  • When you have multiple devices connected to your computer you must specify which one you intend to use, otherwise will get the following error:
adb: error: connect failed: more than one device/emulator

You can specify which device you want to use just the argument -s

adb -s reboot

  • To install a apk file that you have stored in your device just type
adb install myapplication.apk

The command adb install have multiple options but for now i’m not going to much details since in a future post i will explain it better.

  • “What about uninstall?” Yes you can uninstall an application with adb:
adb uninstall com.myapp.packagename

Don’t miss the next episode! Ooopss… next post! 😀