How to Create Android Virtual Device (AVD)

Sunday, January 8, 20121comments

Using the Emulator

Before we start this tutorial, make sure that you have install Android SDK for Eclipse. For more details please see this tutorial Install Android SDK

Create an Android Emulator Device

The Android tools include an emulator. The emulator behaves like a real Android device in most cases and allows you to test your application without having a real device. You can emulate one or several devices with different configurations. Each configuration is defined via an "Android Virtual Device" (AVD).

To define an AVD open the "AVD Manager" via WindowsAVD Manager and press "New".

Create a new AVD

Enter the following.

Settings for a new AVD

We can also select the box "Enabled" for Snapshots. This will make the second start of the virtual device much faster.

At the end press the button "Create AVD".This will create the device and display it under the "Virtual devices". To test if your setup is correct, select your device and press "Start".

After (a long time) your device should be started.

Emulator Shortcuts

Obviously you can use the emulator via the keyboard on the right side of the emulator. But there are also some nice shortcuts which are useful.

Alt+Enter maximizes the emulator. Nice for demos.

Ctrl+F11 changes the orientation of the emulator.

F8 turns network on / off.


Try to use a smaller resolution for your emulator as for example HVGA. The emulator gets slower the more pixels its needs to render as it is using software rendering.

Also if you have sufficient memory on your computer, add at least 1 GB of memory to your emulator. This is the value "Device ram size" during the creation of the AVD.

Also set the flag "Enabled" for Snapshots. This will save the state of the emulator and let it start much faster.

Error handling and typical problems

Things are not always working as they should. This section gives an overview over typical problems and how to solve them.

Clean Project

Several users report that get the following errors:

  1. Project ... is missing required source folder: 'gen'

  2. The project could not be built until build path errors are resolved.

  3. Unable to open class file

To solve any of these errors, go to the project menu and select Project -> Clean.

Problems with Android Debug Bridge (adb)

The communication with the emulator or your Android device might have problems. This communication is handled by the Android Debug Bridge (adb).

Eclipse allows to reset the adb in case this causes problems. Select therefore the DDMS perspective via WindowOpen PerspectiveOtherDDMS

To restart the adb, select the "Reset adb" in the Device View.


The "LogCat" View shows you the log messages of your Android device and help you analyze problems. For example Java exceptions in your program would be shown here. To open this view, select WindowShow ViewOtherAndroidLogCat.

Emulator does not start

If your emulator does not start, make sure that the android-sdk version is in a path without any spaces in the path name.

Error message for @override

The @override annotation was introduced in Java 1.6. If you receive an error message for @override, change the Java compiler level to Java 1.6. To do this right-click on the project, select PropertiesJava Compiler Compiler compliance level and select "1.6" in the drop-down box.

Missing Imports

Java requires that classes which are not part of the standard Java Language be either fully qualified or declared via imports.

If you see error message with "XX cannot be resolved to a variable", right-click in your Editor and select Source Organize Imports to important required packages.

Eclipse Tips

To work more efficiently with Eclipse, select WindowPreferencesJavaEditorSave Actions and select that the source code should be formatted and that the imports should be organized at every save.

Share this article :
Powered by Blogger.
Copyright © 2011. Android Tutorials - All Rights Reserved
Proudly powered by Blogger