Useful adb Commands for Android Development

Useful adb Commands for Android Development

Here we will discuss some useful adb Commands for Android Development. Before going to discuss details about some useful  adb commands for android development, let’s know what is adb exactly in android. How it works? Most of the interviews, you might face this question.

Android Debug Bridge (adb) is a command line tool, which communicates with a connected emulator or android device. It is a client-server program and divided into three different components:

  • A client, which runs on your PC (development machine).
  • A server, which runs as a background process on your PC (development machine). It manages communication between the client and the adb daemon running on an emulator or device.
  • A daemon, which runs as a background process on your connected emulator or device.

adb Path in your System

You can find the adb tool in your PC. Path is like: <sdk>\platform-tools\.
Example: C:\my_android\android-sdk-windows\platform-tools\
Note: You can also run all adb commands using windows command prompt(cmd), make sure to set the environment variable for it. If you did not set environment variable, then you need to navigate to the “<sdk>\platform-tools\” directory in cmd prompt and then type adb commands.

How adb Command works?

First adb client checks whether there is an adb server process already running. If there is no server running, it starts the server. Then the adb server sets up connections to all running emulator/device instances.

Please Note that, To Run any adb command, you can goto your command prompt. Then type adb your_adb_command.

Useful adb Commands for Android Development

 1. Adb command for Querying Emulator/Device Instances

adb devices

adb devices

 2. Adb command to a Specific Emulator/Device

adb -s <serialNumber> <command>
adb -s emulator-5556 install helloWorld.apk

3.   adb command for Installing an Application

adb install <path_to_apk>

adb install C:\hellowWorld.apk

4. adb Commands for Copying Files to or from an Emulator/Device

To copy a file or directory (and its sub-directories) from the emulator or device, use
adb pull <remote> <local>

To copy a file or directory (and its sub-directories) to the emulator or device, use
adb push <local> <remote>

Note: In the above commands, <local> and <remote> refer to the paths to the target files/directory on your development machine (local) and on the emulator/device instance (remote).

adb push xyz.txt /sdcard/xyz.txt

5. adb Shell Commands

Adb supports a Unix shell that you can run a variety of commands. The command binaries are stored in the file system of the emulator or device, at /system/bin/...

Two of the most common command tools are activity manager (am) and package manager (pm).

You can use the shell command to issue commands, with or without entering the adb remote shell on the emulator/device. To issue a single command without entering a remote shell, use the shell command like below:

adb [-d|-e|-s <serialNumber>] shell <shell_command>
Or enter a remote shell on an emulator/device like this:

adb [-d|-e|-s <serialNumber>] shell
When you are ready to exit the remote shell, press CTRL+D or type exit.

 6. adb Command for start/restart and stop/kill server

Note: If sometimes adb server is not responding, then you need to kill the server and start it again.

adb start-server
adb kill-server

  7. adb Commands for get sqlite3 databases from a remote shell

You can use adb remote shell to manage SQLite databases created by other Android applications.

For invoking sqlite3, we need to specify the full path to the database. Note that, Emulator/device store SQLite3 databases in the folder /data/data/<package_name>/databases/.


adb -s emulator-5554 shell
# sqlite3 /data/data/
SQLite version 3.3.12
Enter “.help” for instructions
…. enter commands, then quit…
sqlite> .exit

Once you’ve invoked sqlite3, you can issue sqlite3 commands in the shell. To exit and return to the adb remote shell, use exit or CTRL+D.

8. UI/Application Exerciser Monkey

The simplest way to use the monkey is with the following command, which launches your application and sends 500 pseudo-random events to it.

adb shell monkey -v -p 500

I hope this small tutorial will help you at it’s best.


Post By SmrutiRanjan (57 Posts)

Working @ Samsung as a Project Lead for Android Smartphones. I have been blogging since 2008. Previously I was writing articles for other bloggers, but finally I have started my own blog-"Techblogon".I am also an active contributor for the blog-"Gadgets n Gizmos World". Job is my necessity, but blogging is my passion.

Website: → Techblogon


One Response to Useful adb Commands for Android Development

  1. ANURAG SHARAN says:


Leave a Reply

Your email address will not be published. Required fields are marked *

7 + = eight

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">