Directing Commands to a Specific Emulator/Device InstanceIf multiple emulator/device instances are running, you need to specify a target instance when issuing adb commands. To so so, use the
-soption in the commands. The usage for the
adb -s <serialNumber> <command>As shown, you specify the target instance for a command using its adb-assigned serial number. You can use the
devicescommand to obtain the serial numbers of running emulator/device instances.
Here is an example:
adb -s emulator-5556 install helloWorld.apkNote that, if you issue a command without specifying a target emulator/device instance using
-s, adb generates an error.
Installing an ApplicationYou can use adb to copy an application from your development computer and install it on an emulator/device instance. To do so, use the
installcommand. With the command, you must specify the path to the .apk file that you want to install:
adb install <path_to_apk>
Note that, if you are using the Eclipse IDE and have the ADT plugin installed, you do not need to use adb (or aapt) directly to install your application on the emulator/device. Instead, the ADT plugin handles the packaging and installation of the application for you.