Sams Teach Yourself Java™ in 24 Hours (Covering Java 7 and Android)

(singke) #1
ptg7068951

350 HOUR 24:Writing Android Apps


Setting Up an Android Emulator
Before you can build anAndroid app, you must set its debugging environ-
ment. This can be handled within Eclipse. You must set up an Android
Virtual Device (AVD) that can run the app on your desktop as an emulator.
You also must create the project’s debug configuration. When you’re done,
you can build the app and run it in the emulator.
To configure an Android Virtual Device, first click the green Android icon
with a down arrow in the Eclipse toolbar, which is shown in Figure 24.4.

FIGURE 24.4 Android SDK and AVD Manager
Configuring an Android Virtual
Device.


This launches the Android SDK and AVD Manager, one of the tools in the
Android SDK. Click the Virtual Devices item in the left pane. The emula-
tors that you’ve created are listed to the right. The manager is shown in
Figure 24.5.
To add anew emulator, click New and follow these steps:


  1. In the Name field, give it the name SimpleAVD.

  2. In the Target field, you must choose a target version of Android from
    the drop-down menu. Choose Android 2.2 - API Level 8.

  3. In the Size field, choose a size for the fake SD card. Enter 1024 and
    choose MiB from the associated drop-down for an SD card that’s
    1024MB in size. You must have this much available space on your
    computer, so choose smaller if you’d prefer not to take up that much
    space. The minimum size is 9MB.

Free download pdf