B1 Recapping the Android Debug Bridge

Although we covered the Android Debug Bridge (adb) in chapter 2, a recap is in order as background for signing and installing applications and working with Android devices.

The adb is a client/server program that lets you interact with the Android SDK in various ways, including pushing and pulling files, installing and removing applications, issuing shell commands, and more. The adb tool comprises three components: a development machine-based server, a development machine client for issuing commands, and a client for each emulator or device in use. (Other Android tools, such as the DDMS tool, also create clients to interact with the adb.)

You can make sure your local adb server is running by issuing the adb start-server command. Similarly, you can stop your server with adb kill-server and then restart it, if necessary (or just to get familiar with the process). When you start the Eclipse/ADT environment, it automatically starts an adb server instance.

Once you are sure your adb server is running, you can tell if any devices or emulators are connected by issuing the adb devices command. The output of this command with an emulator running and a physical device attached via a USB cable is shown here:

#$ adb devices List of devices attached emulator-5554 device HT84 5GZ4 9611 device

There are many more adb commands and uses than we are addressing here, of course, and obviously adb is very important in terms of developing Android applications (it is the chassis of the entire SDK), but it's important to understand that it supports both the emulator and any connected physical devices. The first step in getting your applications onto an actual device is to connect your device and make sure it is recognized by the adb and then run the applications from the SDK (to make the process as simple as possible, close down any running emulators and restart your adb server, then connect your device so that it is the only option present).

0 0

Post a comment