Installing the Android SDK
Once you've installed the Android SDK, you can play with various releases of Android including the Honeycomb release (3.1) designed for tablets.
Step 1: Navigate to developer.android.com and click on the SDK link or the Download link. Select the installer for your platform. The Windows installer is highlighted in the image. If you are running OSX or Linux, follow the instructions here.
Figure 9: Windows Android Installer
The installer, when run for the first time, will scan to find the JDK (see Figure 10). If the installer complains that it cannot find the JDK even though you have installed it, then press the back button and click ‘Next’, this should resolve the problem. The installer has a bug and sometimes it does not find the JDK properly. Make a note of the directory/folder where you install the Android tools, as this is needed later to configure the Eclipse IDE plug-in.
Figure 10: Android installer detects the JDK if it is installed.
Step 2: Once the installer has copied all of the tool files into the target directory, it will start the SDK Manager automatically. The SDK manager downloads the Android OS platforms and gives you the option to select different releases to download. So, you can choose to download just a specific set of releases — for instance 2.2 and 2.3, or you can download all of the releases. In this step, if you ‘Accept All’ (bottom right) it will download all releases.
Figure 11: SDK Manager set to download all platform releases of Android.
The recommended option is to download everything, but this will download around 1GB of platform files. If you prefer to reduce the download size, then select the following options:
- Android SDK Platform-tools
- Documentation of Android SDK
- SDK Platform Android 2.3.3, API 10
- SDK Platform Android 2.2, API 8
- SDK Platform Android 2.1, API 7
- Samples for SDK API 10
- Samples for SDK API 8
- Samples for SDK API 7
- Google APIs by Google Inc., Android API10
- Google APIs by Google Inc., Android API8
- Google APIs by Google Inc., Android API7
- Google USB Driver package
- Android Compatibility package
Figure 12: SDK Manager selections set to download only a sub-set of the platforms.
The download progress window will show the approximate time to complete the download and indicate the various platforms that have been downloaded and installed. These are stored in the ‘platforms’ sub-directory (in the location where you originally place the Android tools).
Figure 13: The progress bar shows information of the various packages as they are installed.
Step 3: Once you have downloaded the various platform tools, we need to create a virtual Android device using the SDK Manager and run this in the emulator.
The process is as follows - Select ‘Virtual devices’ from the list on the left hand side of the window (see Figure 14). Select ‘New…’ to create a new virtual device. We will create a virtual device for the Android 2.2 platform (see Figure 15). Provide a value for the SD Card, as a number of sample applications expect this and will not run properly otherwise. A value of around 256MB is sufficient for the SD Card. The larger this value, the larger the image of the virtual machine on your computer. Finally, enable the Snapshot feature as his will allow you to restart a virtual machine quickly.
Figure 14: The SDK Manager with no virtual devices configured.
Figure 15: Create an Android Virtual Device for the 2.2 release with 256MB SD Card
Step 4: Start the Virtual Machine that you have created. The first time you start a virtual device, it takes several minutes and may be well over 5 minutes (see Figure 16). If the snapshot feature is enabled, the next start up will be a much faster process. Why so slow? The virtual device creates a full features ARM powered virtual hardware machine, then installs the operating system on that virtual hardware, and then it boots up. Google has promised to optimise this process in future releases.
Figure 16: The initial boot-up is a very slow process and will last several minutes. Go ahead, take a break and enjoy your favourite beverage.
Once Android fully boots up and launches, you will be presented with an initial screen where you can explore the virtual Android platform. If you are new to Android, click the grid icon (bottom centre) to see the applications installed by default in the virtual device.
Figure 17: Initial start screen of the virtual Android Device.
Step 5: Search for ‘APC Magazine’ in the Google search bar inside the Virtual Android device. If your network connection is working, it should connect to the net and complete the search (see Figure 18). Press the back button (the one with the curved arrow on the right hand panel) to return to the home screen.
Figure 18: Search inside the Android Emulator
You can also explore the various menu options from the Home screen. If you press the Menu button, these options will come up from the button part of the screen (see Figure 19). Explore the settings panel, or add additional widgets using the Add option. You can explore and see the option in the contextual menu in the browser as well.
Figure 19: Android devices offer a contextual menu for most screens.
As a final step, shutdown the emulator, and the SDK manager. We need to do this before installing the Eclipse Android plug-in.