- Beginning Android
- Beginning Android: Install an Android Platform
- Beginning Android: Explore and Build Your First App
- Beginning Android: Create an Android Virtual Device
- Beginning Android: Launching the Android Virtual Device
- Beginning Android: Installing and Running Your First App
- Beginning Android: Developing Apps with Eclipse
Lesson 2: Install an Android Platform
Google provides various Android platforms that can be installed via the SDK’s SDK Manager tool. Lesson 2 shows you how to use
SDK Manager to install the Gingerbread platform (version 2.3.3) and platform tools.
Note Gingerbread is a code name for Android 2.3 and minor updates (e.g., 2.3.3). Google is in the habit of naming its platforms after dessert items.
Start the Android SDK Manager Application
Start SDK Manager (or android, which is one of the basic tools). After a few moments, you will see this application’s Android SDK Manager window with content similar to that shown in Figure 2.
Android SDK Manager presents a user interface organized into a menubar and a content area. The menubar presents Packages and Tools menus:
- The Packages menu presents menuitems for displaying some combination of updated or new packages (Android components), installed packages, and obsolete packages. It also presents menuitems for sorting the list of packages by API level or repository, and for reloading the list of packages shown in the content area.
- The Tools menu presents menuitems for managing Android Virtual Devices (device configurations that are run with the Android emulator) and add-on sites, for specifying options related to proxies (computers or applications that sit between networks as intermediaries) and other items, and presenting about information.
The content area presents the SDK’s path, a table of package information, checkboxes for determining what categories of packages to display, radio buttons for selecting how packages are sorted, buttons for installing and deleting packages, and a progress bar that displays the progress made by SDK Manager as it scans Google’s servers for package information (at startup and when Reload is selected from Packages).
Install Gingerbread 2.3.3 and Platform Tools
Uncheck Android 4.0.3 (API 15), which automatically unchecks all of the checkboxes underneath in its hierarchy. Instead, check Android 2.3.3 (API 10), which automatically checks all of the checkboxes underneath, and check Android SDK Platform-tools as well. You should end up with the user interface shown in Figure 3.
The Install button identifies 22 packages to be installed. This count includes the Google USB Driver package in the Extras section (at the bottom of the window). You can uncheck this package if you don’t have an actual Android device and plan to do all of your development via the Android emulator. However, you might as well keep it checked.
Click Install and you will encounter Figure 4’s Choose Packages to Install dialog box.
The Choose Packages to Install dialog box presents a list of packages along with information about the highlighted package in the pane on the list’s right. The Accept and Reject radio buttons let you accept or reject the highlighted package. You can accept all packages by selecting the Accept All radio button.
The Accept button for a package with a green checkmark beside its name is selected. Neither the Accept nor Reject button is selected when a questionmark appears. This is certainly true for the Google USB Driver package. You will need to highlight this package and select its Accept radio button to ensure that it’s installed (assuming that you want to install this component).
Click Install to install all checked packages. Figure 5 displays the Android SDK Manager Log window that appears over the Android SDK Manager window, and which provides installation details. It also shows a progress bar that reveals the amount of progress made in installing all selected packages.
Figure 5 includes a “Stopping ADB server failed (code -1).” message. ADB stands for Android Debug Bridge, which is a tool consisting of client and server programs that let you control and interface with your Android device. This message appears because the ADB server isn’t running at this point.
During installation, you will probably encounter Figure 6’s ADB Restart dialog box.
If you haven’t developed for Android before, the ADB server won’t be running and there’s no point in restarting it now. Therefore, click the No button.
After installation finishes, you’ll see a “Done loading packages.” message at the bottom of the Android SDK Manager and Android SDK Manager Log windows. Close Android SDK Manager Log.
Because Android SDK Manager’s user interface is somewhat buggy, its Install button continues to show that packages need to be installed. You can eliminate this confusion by unchecking and then checking both of the Updates/New and Installed checkboxes.
Figure 7 shows the packages that should be installed. You don’t have to have the Google UDB driver installed unless you plan to install and test your apps on a real Android device.
The following review questions help you test your mastery of Lesson 2’s material:
- How do you start the Android SDK Manager application?
- Describe this application’s Android SDK Manager window.
- What does this application’s Packages menu let you accomplish? What does its Tools menu let you accomplish?
- How do you choose packages to install? How do you view only installed packages?
- What does the Android SDK Manager Log window display?
- What is ADB?
Jeff Friesen is a freelance tutor and software developer with an emphasis on Java and mobile technologies. In addition to writing Java and Android books for Apress, Jeff has written numerous articles on Java and other technologies for SitePoint, InformIT, JavaWorld, java.net, and DevSource.