Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Run on the Emulator

Whether you're using Eclipse or the command line, to run your app on the emulator 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 devices.

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

To create an AVD:

  1. Launch the Android Virtual Device Manager:
    1. In Eclipse, click Android Virtual Device Manager from the toolbar.
    2. From the command line, change directories to <sdk>/tools/ and execute:
android avd
  1. In the Android Virtual Device Manager panel, click New.
  2. Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and a skin (HVGA is default).
  3. Click Create AVD.
  4. Select the new AVD from the Android Virtual Device Manager and click Start.
  5. 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
  1. Make sure the Android SDK platform-tools/ directory is included in your PATH environment variable, then execute:
adb install bin/MyFirstApp-debug.apk
  1. On the emulator, locate MyFirstActivity and open it.

That's how you build and run your Android app on the emulator! To start developing, continue to the next lesson.


Date: 2014-12-29; view: 1022


<== previous page | next page ==>
You should also read | Create a Linear Layout
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.008 sec.)