230

I made a simple "Hello World" program in Eclipse. I added nothing to a Java file and only added a text view in file main.xml as

//main.xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Hello World"
    />
</LinearLayout>

And now when I run my program it shows the following in the console.

//console output
[2011-07-10 07:10:22 - demo] ------------------------------
[2011-07-10 07:10:22 - demo] Android Launch!
[2011-07-10 07:10:24 - demo] adb is running normally.
[2011-07-10 07:10:24 - demo] Performing com.demo.DemoActivity activity launch
[2011-07-10 07:10:25 - demo] Automatic Target Mode: launching new emulator with compatible AVD 'vishal'
[2011-07-10 07:10:25 - demo] Launching a new emulator with Virtual Device 'vishal'
[2011-07-10 07:11:06 - Emulator] invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe.
[2011-07-10 07:11:07 - Emulator] Hint: use '@foo' to launch a virtual device named 'foo'.
[2011-07-10 07:11:07 - Emulator] please use -help for more information

//--------------------------------------------------------------------------------/

This shows my Android Virtual Device (AVD) could not start due to some reason. What can I do to fix this problem?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Max
  • 5,733
  • 4
  • 30
  • 44

11 Answers11

317

There is currently a problem with R12 where the SDK location cannot contain any spaces.

The default installation location is: C:\Programme Files(x86)\Android\android-sdk. They are currently fixing the problem but you can currently work around it by changing the SDK location path in eclipse to C:\PROGRA~2\Android\android-sdk.

If you are running 32-bit Windows, change the path to C:\PROGRA~1\Android\android-sdk.

Community
  • 1
  • 1
NickC
  • 3,171
  • 2
  • 13
  • 2
  • 30
    If you don't know the 8-dot-3 name of your desired path, just fire up a Command Prompt and execute "DIR /X"... the short name will be displayed next to each directory. – Jay Mayu Jul 27 '11 at 10:40
  • Can this be fixed in Eclipse? – Britt Wescott Aug 16 '11 at 05:45
  • I've tried this and it's still not working on my 32 bit Windows 7 machine. My SDK is in the following path D:\Program Files\Android\android-sdk and I've put the following in my SKD location path in eclipse but with no luck. D:\PROGRA~1\Android\ANDROI~1 – BillyPilgrim Aug 19 '11 at 00:34
  • 3
    I ended up just copying the android-sdk directory directly into the root of the D drive adn updated the SDK path in Eclipse to reflect the new location. Worked like a charm. – BillyPilgrim Aug 19 '11 at 01:39
  • 8
    that is ridiculous, I reckon 99% of people encounter this problem when attempting to get started with android! – jcvandan Sep 07 '11 at 20:56
  • Thanks for providing the answer I needed, NickC! However, I ran into similar problems with actually running the AVD; I just moved the whole android-sdk folder to "C:\Programs\Android\android-sdk" and changed my PATH, etc, and that solved my issues. (I set aside the '\Programs' folder for non-installed Win apps, like traditional Eclipse and various command line tools.) – Brian Lacy Sep 14 '11 at 13:30
  • Thanks for this! I'd just like to add that the directory path entry is case-sensitive so you must use 'PROGRA~1' literally when changing this value in Eclipse (Window->Preferences->Android) or whatever IDE you are using. – J.Churchill Oct 30 '11 at 10:55
52

I'd suggest creating a directory junction named C:\Android pointing to the actual C:\Program Files (x86)\Android\android-sdk-windows\:

MKLINK /J C:\Android "C:\Program Files (x86)\Android\android-sdk-windows\"

and then setting the newly created junction as SDK Location for your Eclipse ADT Plugin (Eclipse menu\ Window\ Preference\ Android). This might help for a number of tools/ plugin too that have problems with spaces in paths.

superjos
  • 12,189
  • 6
  • 89
  • 134
  • 1
    Nice idea. You could also create it as a [symbolic link](http://en.wikipedia.org/wiki/NTFS_symbolic_link), which is the newer way since Windows Vista. – Hosam Aly Sep 21 '11 at 21:14
33
  • If your SDK location path in Eclipse is in C:\Program Files (x86)\ change to C:\PROGRA~2\.
  • If you are running 32-bit Windows, C:\Program Files\, change the path to C:\PROGRA~1\.

enter image description here

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
24

NickC is correct. It is also worth pointing out that the SDK location is set in Eclipse > Window menu > Preferences > Android. If your folders are different you can check the 8.3 format of any folder with dir foldername /x at the command prompt.

Caltor
  • 2,538
  • 1
  • 27
  • 55
15

I had this issue as well. The solution is (if you are on Windows as I am) to change the path to C:\PROGRA~1\Android\android-sdk-windows\.

Assuming Program Files is the first directory with the word PROGRAM in it which it should be. This worked.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Scott
  • 151
  • 2
7

I started Task Manager, made sure adb.exe is closed (it locks some files)

Create the folder C:\Android Moved folder + all files from C:\Program Files\android-sdk to C:\Android

Edited C:\Documents and Settings\All Users\Start Menu\Programs\Android SDK Tools shortcuts.

I considered uninstalling the SDK and re-installing, but for the life of me, where does it store the temp files?? I don't want to re-download the platforms, samples and doco that I have added to the SDK.

RichardTheKiwi
  • 105,798
  • 26
  • 196
  • 262
4

I had the same problem. I made it work with:

"C:\Program Files (x86)\Android\android-sdk\tools\emulator-arm.exe"  @foo

foo is the name of your virtual device.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
3

emulator-arm.exe error, couldn't run. Problem was that my laptop has 2 graphic cards and was selected only one (the performance one) from Nvidia 555M. By selecting the other graphic card from Nvidia mediu,(selected base Intel card) the emulator started!

marisxanis
  • 109
  • 8
3

As an alternative to the PROGRA~2 method (which is not working for example in IntelliJ IDEA), you can create a symbolic link.

It can be named, for example, prg to Program Files (run mklink /? from the command line to learn how to do it). Then run the emulator as C:\prg\Android\android-sdk\tools\emulator.exe. Also change the path to SDK/emulator in your IDE.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Dmitry Osinovskiy
  • 9,999
  • 1
  • 47
  • 38
  • 1
    Be careful when posting copy and paste boilerplate/verbatim answers to multiple questions, these tend to be flagged as "spammy" by the community. – Kev Jul 12 '11 at 18:31
  • 1
    @Kev What about duplicate questions? :P – Timothy003 Jul 12 '11 at 19:51
2

Remember to run "android update avd -n avd_name" after change in Android SDK path.

fury
  • 132
  • 1
  • 8
-2

This don't work since Andoid SDK R12 update. I think is because SDK don't find the Java SDK Path. You can solve that by adding the Java SDK Path in your PATH environment variable.

Apehel
  • 11