views:

498

answers:

1

I installed all the prerequisites for Android development. I created a virtual device through Eclipse and tried to run the Hello World sample application in that device. I received the following error message.

emulator: ERROR: unknown virtual device name: 'Android21Device'
emulator: could not find virtual device named 'Android21Device'

I get the same error when I try to start the device from the command line and through the SDK program.

I can see the device directory and files at

D:\Users\anthony\.android\avd\Android21Device.avd

+4  A: 

Android Virtual Device Tool

The Virtual Device tool in the SDK Manager creates virtual devices in your user profile directory... in this case a secondary drive

D:\Users\anthony\.android

But, the emulator tries to load virtual device images from the system drive

C:\Users\anthony\.android

Directory Junction

There are two workarounds. First, you can create a directory hard-link (or junction) from the system drive android folder to the one in your user profile. In Windows 7, you can use the following command

mklink /J C:\Users\anthony\.android D:\Users\anthony\.android

Android Home

The Android SDK Manager and emulator can use an environment variable ANDROID_SDK_HOME to identify the location of the .android directory. Set a user or environment variable

ANDROID_SDK_HOME = 'D:\Users\anthony'

Anthony Mastrean
The environment variable should be 'D:\Users\anthony', since '.android' is appended automatically.
Christian Davén
Oh, and it seems that the "Android SDK and AVD Manager" inside of Eclipse doesn't honor the environment variable. So I went with the junction instead, and it works.
Christian Davén
The environment variable works fine for me. You just have to restart Eclipse for it to pick it up. :)
Guffa