二:Run the Emulator

Whether you’re using Eclipse or the command line, you need to first create an Android Virtual Device (AVD). An AVD is a device configuration for the Android emulator that allows you to model different device configurations.

Figure 1. The AVD Manager showing a few virtual devices.

To create an AVD:

  1. Launch the Android Virtual Device Manager:
    1. In Eclipse, select Window > AVD Manager, or click the AVD Manager icon in the Eclipse toolbar.
    2. From the command line, change directories to <sdk>/tools/ and execute:
      ./android avd
  2. In the Android Virtual Device 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, open one of your project's files and click Run from the toolbar. 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.

转至:http://www.android-doc.com/training/basics/firstapp/running-app.html#Emulator

 

 

posted @ 2014-04-30 09:32  fangtest  阅读(109)  评论(0)    收藏  举报