Game Development Reference
In-Depth Information
Note Check out the ADB documentation on the Android Developers site at
http://developer.android.com for a full reference list of the available commands.
A very useful task to perform with ADB is to query for all devices and emulators connected
to the ADB server (and hence your development machine). To do this, execute the following
command on the command line (note that > is not part of the command):
> adb devices
This will print a list of all connected devices and emulators with their respective serial numbers,
and it will resemble the following output:
List of devices attached
HT97JL901589 device
HT019P803783 device
The serial number of a device or emulator is used to target specific subsequent commands at
it. The following command will install an APK file called myapp.apk located on the development
machine on the device with the serial number HT019P803783 :
> adb -s HT019P803783 install myapp.apk
The -s argument can be used with any ADB command that performs an action that is targeted at
a specific device.
Commands that copy files to and from the device or emulator also exist. The following
command copies a local file called myfile.txt to the SD card of a device with the serial number
HT019P803783 :
> adb -s HT019P803783 push myfile.txt /sdcard/myfile.txt
To pull a file called myfile.txt from the SD card, you could issue the following command:
> abd pull /sdcard/myfile.txt myfile.txt
If there's only a single device or emulator currently connected to the ADB server, you can omit the
serial number. The adb tool will automatically target the connected device or emulator for you.
It's also possible to debug a device using ADB over the network (without USB). This is called ADB
remote debugging and is possible on some devices. To check if your device can do it, find the
Developer options and see if “ADB over network� is in the list of options. If so, you are in luck.
Simply enable this remote debugging option on your device, and then run the following command:
> adb connect ipaddress
Once connected, the device will appear just as if it were connected via USB. If you don't know the
IP address, you can usually find it in the Wi-Fi settings by touching the current access point name.
Of course, the ADB tool offers many more possibilities. Most are exposed through DDMS,
and we'll usually use that instead of going to the command line. For quick tasks, though, the
command-line tool is ideal.
Search WWH ::




Custom Search