36

I want to write an Android app and I've started this morning by loading JDK, eclipse, SDK etc, all from the adt-bundle-windows-x86_64-20130219 from http://developer.android.com.

The issue for me right now:

[2013-02-27 13:36:26 - Test2] Android Launch!
[2013-02-27 13:36:26 - Test2] adb is running normally.
[2013-02-27 13:36:26 - Test2] Performing com.example.test2.MainActivity activity launch
[2013-02-27 13:37:27 - Test2] Launching a new emulator with Virtual Device 'droidX2'
[2013-02-27 13:37:27 - Emulator] PANIC: Could not open: droidX2

I've been sifting though posts on the web all morning about AVD and I haven't seen one that didn't involve the path being messed up and the .ini not found. I don't think I've got a path issue. AVD is looking for files on D:\USERS\XXX\.android\avd and that's where the files are. So don't understand why the emulator can't open.

I've done the most basic things like remove and re-install everything, read the notes at orace etc. Basically I'm stuck. Any suggestions here?

adt-bundle-windows-x86_64-20130219 was what I loaded on Windows 7 (32bit).

I'd settle for testing on the mobile that's connected to the PC but I can't get that to work either!

Any direction appreciated.

Nandu
  • 3,076
  • 8
  • 34
  • 51
NigelT
  • 363
  • 1
  • 3
  • 4

11 Answers11

76

This has been asked a few times already, try these:

Create a environment variable called: ANDROID_SDK_HOME and set it to C:\Users\Administrator Open Eclipse > Window > Preferences and click in Run/Debug and String Substitution Add a new variable called: user.home and set it to C:\Users\Administrator Create an AVD and run it.

Original answer by Colin

an android project member says here:

As a work-around, you can define the environment variable ANDROID_SDK_HOME to point to the directory containing your .android directory. The emulator and SDK Manager will pick it up properly.

Community
  • 1
  • 1
Nezam
  • 4,122
  • 3
  • 32
  • 49
  • 1
    Hey there. Thanks for your reply. Yes, I had check those posts previously and have just looked at this again to be thourough. No change. – NigelT Feb 27 '13 at 04:31
  • Unfortunately no. No change. Is there any log or info that will tell me more about why it "Could not open"? – NigelT Feb 27 '13 at 04:33
  • 11
    Solved. I set the environment variable to ANDROID_SDK_HOME to point to the directory containing your .android directory. I never tried this. Thanks. – NigelT Feb 27 '13 at 04:43
  • I set it as a System Environmental Variable and it worked. DUnno if a user variable would work also. – Raven Dreamer Mar 11 '13 at 01:13
  • 8
    Good tip, don't forget to restart Eclipse after changing the environment variables. I didn't and couldn't work out why the changes were not working until I did and they magically started to work. – lambsubstitute Jul 26 '13 at 10:25
  • it worked for me but I had to restart windows. thanks! – Apperside Dec 01 '14 at 19:47
  • Using a non-English Windows, this worked for me only after setting the `ANDROID_SDK_HOME` to the "Users" folder in my own language (`C:\Benutzer\...`) even though both `C:\Users\...` and `C:\Benutzer\...` are working in the explorer. – Dominic Jan 07 '17 at 18:23
12

verify that The location in which the avd was searched from is different from where it is actually created. Take a look at the screenshot below for more information.

Android Virtual Devices Manager - location of virtual devices

user2548816
  • 121
  • 1
  • 5
  • 3
    May be he was trying to point out that it *should* be the same.lol – Nezam Sep 25 '13 at 04:31
  • hey guys i just posted the corrected location,, it was actually different and i posted the screen shot after i fixed the issue,, but however ones having the problem can cross check if the paths highlighted are same or not. – user2548816 Jul 19 '14 at 06:57
  • it some times looks for the avd in that location but some times the avd is not there ,, and get created in some other folder and hence we have the error.. so place the avd in specified folder and it would be fine – user2548816 Nov 02 '14 at 18:03
6

ANOTHER OPTION: Symlinking...

In a command prompt (with admin privileges), change directory ("cd") to "C:\Users\YourUserName.android" and then use the following command to create a symlink to the avd directory (notice the direction of the slashes):

mklink /D avd D:\_MyLibrariesDir\.android\avd

Where "_MyLibrariesDir" is the directory that your libraries (photos, documents, etc) folders are located.

And you're done!


Explanation: This has the same effect as the ANDROID_SDK_HOME option except that you can now browse to [C:\Users\YourUserName\.android\avd\*] and [D:_MyLibrariesDir\.android\avd\*] and both will take you to the same spot.

This differs from a shortcut in that shortcuts do not act as directories, so if you just had a shortcut to the "avd" folder, you could not go to "C:\Users\YourUserName\.android\avd*" as it would produce a file not found error and if you tried to click on an avd shortcut file it would take you to [D:_MyLibrariesDir\.android\avd\*] instead of keeping you on the C drive. Symlinks act a bridge between locations in a way that is transparent to user and software. Quite handy :)

Nalorin
  • 95
  • 1
  • 9
  • 1
    It's best to use Junctions instead of directory symlinks since Junctions are invisible to applications, unless they _specifically_ ask to see them (OPEN_REPARSE_POINT given as an argument when looking for/opening files). – Smiley Barry Nov 02 '13 at 10:43
  • Using the string substitution menu in Eclipse didn't work for me for some reason. However, creating a symlink solved the problem. I think the problem was caused by my having a separate partition for my data folders (such as my documents, my pictures etc) – mahela007 Feb 06 '14 at 14:42
6

I fixed the AVD Panic issue by running Eclipse as an administrator.

Tom Anderson
  • 942
  • 8
  • 16
3

On Ubuntu check the current user if you run eclipse as root (sudo) eclipse could NOT find the /root/.android set the user home

user.home /home/<user>/

and copy the AVD files into the new directory than changes the privileges

cd /home/<user>/
chgrp <user> -R .android
chgrp <user> -R .android
venergiac
  • 7,469
  • 2
  • 48
  • 70
2

Simply if nothing works for you, just copy the folder avd which you could find in your .android folder to C:\Users\<user name>\.android.

Brant Olsen
  • 5,628
  • 5
  • 36
  • 53
Mohamed Mo Kawsara
  • 4,400
  • 2
  • 27
  • 43
1

Pls check once in Ur ".android" folder, another/duplicate ".android" folder might have been created. If "YES" is Ur answer then do this thing because in my case that thing was happened. Simply I just kept only the latest ".android" folder in this directory "C:\Users\USER NAME\" (removed the duplicated one) and then emulator started working for me. Cheers

Vasu
  • 39
  • 5
1

try to add new windows admin user with English language only it worked for me the user name should be in English letters

0

Found a simple way to make it work - worth trying: 1. If you do not have it yet - create a new AVD with the problematic name (in this case droidX2) if you see an overwrite warning - overwrite it. 2. Delete the new AVD you just created in step 1. 3. If you have another AVD it's OK, if not - create one. 4. Retry running the Eclipse project as an Android application - now it should run

0

Setting the ANDROID_SDK_HOME environment variable alone works fine for Win7 and earlier but did not help me on Win8.

For poor tortured souls using the piece of crap which is Windows 8, go to wherever you've installed the Android SDK (e.g. C:\SDK\Android or C:\Users\JoeCitizen\AppData\Local\Android\android-sdk) and make sure both AVD Manager.exe and SDK Manager.exe are set to run as Administrator for all users. Once I did that it worked fine.

Yet another deceptive problem-which-shouldn't-be-a-problem caused by the complete fail which is permission management circa Windows 8.

nathanchere
  • 8,008
  • 15
  • 65
  • 86
0

Using Windows 7, Eclipse, Android SDK tools 23.0.4

First time I followed the exact instruction on http://developer.android.com/training/index.html I got the error "PANIC: could not open.." whenever 'Start' emulator.

Solution: System property popup/Enviroment Variables/ System variables, Added new entry name="ANDROID_SDK_HOME", value = "D:\DATA\Users\ThisUser\" Then it starts work!

"D:\DATA\Users\ThisUser\" is parent folder where ".android/avd" folder exists. avd folder path here is "D:\DATA\Users\ThisUser.android\avd"

Note that you must put "D:\DATA\Users\ThisUser\", not "D:\DATA\Users\ThisUser**.android**"

Sky Kim
  • 159
  • 10