How to create and launch Android AVD Emulator in Eclipse
What is Android Emulator?
- An emulator acts as a real Android device (in most cases) and allows us to run and test the application without having a real device.
- The ADT plugin includes an emulator to deploy and run an Android application.
What is Android Virtual Device (AVD)?
- Before launching the emulator, you must create an Android Virtual Device (AVD) which defines the system image and device settings used by the emulator. Some of the settings are,
- configure the version of the Android system
- size of the SD card
- set of hardware options
- emulator skin
- screen resolution, etc
- You can define several AVD with different configurations and can start them in parallel.
- Starting a new emulator is very slow, because the file system of the new AVD needs to get prepared.
Android AVD v/s Google API
AVD can be created to act either as a Android device or a Google device.
- An AVD created for Android contains examples from the Android Open Source Project.
- If your application uses functionalities provided by Google API such as, Google Maps API, Cloud to Device Messaging (C2DM) then you must create an AVD created for the Google API’s.
Install Google API in Android
Use Android SDK Manager to check whether you have installed Google API as shown below,
Create New AVD
Follow the steps below to create a new AVD,
- In Eclipse, select Window -> AVD Manager.
- Click New…
The Create New AVD dialog appears.
- Type the name of the AVD, for example “first_avd“.
- Choose a target.
- The target is the platform (that is, the version of the Android SDK, such as 2.3.3) you want to run on the emulator. It can be either Android API or Google API.
- [Optional] an SD card size, say 400
- [Optional] Snapshot. Enable this to make start up of emulator faster.
- To test this, enable this option. Get the emulator up and running and put it into the state you want. For example, home screen or menu screen. Now close the emulator. Run it again and now the emulator launches quickly with the saved state.
- [Optional] Skin.
- [Optional]You can add specific hardware features of the emulated device by clicking the New… button and selecting the feature. Refer this link for more details on hardware options.
- Click Create AVD.