Whether you're using
Eclipse or the command line, to run your app on the emulator you need to first
create anAndroid Virtual Device (AVD). An AVD is a device configuration for the
Android emulator that allows you to model different devices.
Figure 1.
The AVD Manager showing a few virtual devices.
To create an AVD:
1. Launch the Android Virtual
Device Manager:
a. In
Eclipse, click Android Virtual Device Manager
from the toolbar.
b. From the
command line, change directories to<sdk>/tools/ and
execute:
android avd
2. In
the Android Virtual Device Manager panel, click New.
3. Fill in the details for the AVD.
Give it a name, a platform target, an SD card size, and a skin (HVGA is
default).
4. Click
Create AVD.
5. Select
the new AVD from the Android Virtual
Device Manager and click Start.
6. After
the emulator boots up, unlock the emulator screen.
To run the app from Eclipse:
1. Open one of your project's files
and click Run from the toolbar.
2. In the Run as window that appears, select Android Application and click OK.
Eclipse installs the app on your
AVD and starts it.
Or to run your app from the command
line:
1. Change directories to the root of
your Android project and execute:
ant debug
2. Make sure the Android SDK
platform-tools/ directory is included in your PATH environment variable, then
execute:
adb install bin/MyFirstApp-debug.apk
3. On the emulator, locate
MyFirstActivity and open it.