You don’t need a real device all the time to test your apps in various API versions and different resolutions. So, the Android SDK comes with a pretty neat tool called the emulator, which allows you to emulate the Android devices. The emulator is pretty straight forward to use. When you want to launch a device, all you need to do is open the Android Virtual Device (AVD) tool either from your SDK folder or straight
from Eclipse. Then, you can either set up a new device with its own memory card, CPU, and screen size as well as other custom features or you can select one of the pre-configured devices from a list.
Before creating an emulator, you need to install latest & required APIs versions from Android SDK manager.
To emulate a device from Eclipse, try the following steps:
1. Click on the AVD manager icon on your Eclipse toolbar.
2. Then AVD will pop up. You can either select a preconfigured featured device or you can set up a device according to your own criteria. As of now, let’s stick to configuring our own devices.
3. Click on New button
4. Then Create new Android Virtual Device (AVD) dialog box should pop up. You need to fill in some metrics for the new virtual devices and give it a name. You can enter whatever you feel here as this post is just to get you to emulate your first device.
5. Once you’re done, click on OK. The new device should show up in the AVD dialog box.
6. Click on the device you just created and click on Start….
At this point, the AVD will prompt you for the screen-size options; the default values aren’t too bad. Click on Launch when you’re done, and in a few seconds your new AVD will start up.
Creating your Own Android Virtual Devices from CLI (Terminal)
1. You can find a list of the system images available to you by using the following
command: path of Android SDK/tools$ ./android list targets
ex: cd /home/Android-sdk/tools; ./android list targets
This will list out few targets with IDs. This depends on the images you’ve downloaded from SDK manager
2. Create the AVD using the following command:
path of Android SDK/tools/android create avd –n [name of your new AVD] –t [system image target id]
You need to decide on a name for the AVD you’ve just created, which you will
specify using the –n switch. The system image ID you selected from the previous step
must be specified using the –t switch. If everything goes well, you should have just
created a brand new virtual machine.
3. You can launch your brand new AVD using the following command:
path of Android SDK/tools/emulator –avd [avd name]
Here, [avd name] is the AVD name you decided on in the previous step. Yea that’s it, your new AVD should start in a moment.
Okay you wanna configure your emulator with external storage/Memory card, then try navigate to pathofSDK and type the command:
android create –avd –n [avd name] –t [image id] –c [size][K|M]
your virtual device emulates some external storage using the –c switch when you create it.
ex: android create –avd –n myFirstAVD –t 7 –c 4028M
Here -n = myFirstAVD, which is my AVD name, -t=7, which is target ID having single ABI and –c =4028M, allocated memory 4GB.
Partitioning sizes in emulator
Another very useful thing that you may want to do is to specify how much space you’d like to allocate the internal storage partitions. You can do this by using the -partition-size switch, which you specify when you invoke the emulator as shown in the following command:
emulator –avd [name] –partition-size [size in MBs]
You will also need to supply a size for the partitions. By default, the unit of measurement is megabytes (MBs).
That’s it, now you know how to create a virtual device using GUI and CLI. Not only AVD Manager, we also have Genymotion for virtual devices. As of now I’m not talking about Genymotion. We will see that later.