Android Emulator Can’t Find AVD
I ran into a small gotcha recently when creating a new Android project in Eclipse. The first time I went to run it on an AVD, I received an error in the console output:
[2011-08-09 19:14:46 - Emulator] emulator: ERROR: unknown virtual device name: 'avd' [2011-08-09 19:14:46 - Emulator] emulator: could not find virtual device named 'avd'
The first few results in Google didn’t turn up any useful information. The culprit turned out to be buried in the Eclipse UI.
- If the Package Explorer view isn’t already active, activate it by selecting Window > Show View > Package Explorer.
- In the Package Explorer view, right-click on your project and select Run As > Run Configurations.
- In the right half of the Run Configurations window, select the small Target tab.
- On the far right side of the window, use the scrollbar to scroll to the bottom of the Target tab’s contents.
- Find the text box labeled Additional Emulator Command Line Options. It probably has a value like this: -cpu-delay 0 -no-boot-anim -avd avd.
- Change the value of the text box to look like -cpu-delay 0 -no-boot-anim -avd AVD Name where AVD Name (which defaults to simply avd) is the name of the AVD you’ve created for this project. In other words, if you open the Android SDK and AVD Manager window (Window > Android SDK and AVD Manager), the value you should use in place of AVD Name within this text box is the same value that appears in the AVD Name column of that window for the desired AVD. So, if your AVD is named MyProjectAVD, the value of the text box should be -cpu-delay 0 -no-boot-anim -avd MyProjectAVD.