sábado, 4 de junho de 2011

Android: Fixed the unknown virtual device error

Font: http://techtraveller.blogspot.com/2009/07/android-fixed-unknown-virtual-device.html


I created my first hello world project as per the samples/help but when I try to run it, eclipse is throwing me following error

[2009-07-11 19:29:08 - Emulator] emulator: ERROR: unknown virtual device name: 'Android15Device'

[2009-07-11 19:29:08 - Emulator] emulator: could not find virtual device named 'Android15Device'

Bad thing for a developer who is just starting on a new platform. Isn’t a hellowrld application supposed to just run? I followed all the steps exactly

  1. I installed everything

  2. Created android virtual device using AVD manager in eclipse

  3. Created a new helloworld project and selected this device

  4. It compiles correctly, no errors

  5. But the damn thing wont run because emulator cannot find the virtual device.

I googled around for some time and was able to fix the issue in no time. Looks like when you create new virtual device using the virtual device manager, it creates them in a .android folder under your user profile. In my case it was


But the emulator always looks into C:\Users\HomeUser\.android which does not exist. There was a work around posted on one of the forum (sorry I lost the link, I will update it asap) which suggests using ntfs junction points. Below are the steps to fix this on Windows 7

  • Open a command prompt

  • Change your directory to C:\Users\<UserName>\

  • Create a link to your original .android folder using the mklink command as below (assume your avd has been created in D:\Users\<UserName>\.android folder

    mklink /J .android D:\Users\<UserName>\.android

Remember to change the <UserName> in above commands to whatever user name you use to login to Windows. That's it, you should now be able to run your application and the emulator will find your virtual devices with no problem.

Nenhum comentário: