The Android Emulator that is part of the Android development SDK is a very powerful tool. It lets you test your application right on your computer without a real Android device by emulating hardware and software features of an android device. That said, the emulator still can’t replace a real device. There are many features that the emulator don’t support and you need a real device to test them. And even otherwise it’s a good idea to always test your application on a real device too. The emulator however provides a debug/test environment right on your computer, which is very convenient.
You can create any virtual device to run on the emulator by using the AVD manager. AVD stands for Android Virtual Devices. With AVD manager you can create and manage your android virtual devices. AVDs are nothing but a set of configurations that tells the emulator to mimic a particular device.
How to create an AVD?
Even though you can use the command line tool of Android SDK to create and manage AVDs, in this tutorial I am working with Eclipse and the graphical AVD manager to create an AVD. So, obviously you need to have Eclipse and Android plug-in for Eclipse installed.
Locate the “Android SDK and AVD manager” icon on the Eclipse toolbar. Click to bring up the AVD manager.
Click on the virtual devices tab on the AVD manager and all your existing AVDs (if you have created any) would be listed.
Now, to create a new AVD. Click on the New button. The “Create a new Android Virtual Device” dialog appears.
Now, this is an important step. If you have any particular device in mind that you want to emulate (that’s why we’re here aren’t we?), you need to create an AVD that resembles the features of your target device. Like, for example, you need to know the screen size and resolution and so on. Anyway, but if you are creating a generic AVD then probably you can get away without going into much details and creating your AVD with the features that you need to test your application.
Okay, let’s name our AVD “MyAVD”, Select target as Android 2.2 , which means the application you are testing would be tested against the Android 2.2 system image on the emulator. Usually, this is where you can stop defining settings and click on Create AVD to create your new virtual device. But as per your requirement you may go ahead and specify various other optional settings. For example, you can emulate an SD card by defining the size of the card, or add specific hardware features (Want your device to feature a trackball?) by clicking the New button on the hardware section and selecting a property etc.
Anyway, I am keeping this simple and creating an AVD with the bare minimum. So I just give my device a name and select the target API (which automatically selects the skin), and I am all set to create my AVD. This is what my AVD manager screen looks like now.
No, all we need to do is to click on the Create AVD button to create our new virtual device. Once created, you can see it listed in the virtual devices tab of the AVD manager.
That’s it, we have created a new AVD using the Android SDK/AVD manager. In the next tutorial we’ll see how to test/debug your application using different AVDS.