53

I updated the Android SDK tools from revision 11 to revision 12, and the emulator now fails to start. When I try to run emulator.exe, I get:

invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe.
Hint: use '@foo' to launch a virtual device named 'foo'.
please use -help for more information

The path to emulator.exe is C:\Program Files\Android\android-sdk\tools.

How do I fix it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Timothy003
  • 2,348
  • 5
  • 28
  • 33

11 Answers11

79

As was previously suggested, it does seem to be caused by the fact that there is a space in the default installation path of the Android SDK: C:\Program Files\Android\android-sdk\

There are a couple of possible solves, though-

  1. move installation directories to paths that do not contains spaces (as already mentioned)...
  2. but simpler and possibly slightly less cumbersome is simply adjusting the path in Eclipse to use 8-dot-3 directory name(s). Since I'm running Win7, I have two Program Files directories, the second one being "Program Files (x86)" which is where the sdk installed. So the 8-dot-3 path is PROGRA~2. Thus, I simply changed the "SDK Location" value in the Android Preferences in Eclipse from C:\Program Files\Android\android-sdk\ to C:\PROGRA~2\Android\android-sdk\ and everything now works fine.

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.

Carl S
  • 891
  • 6
  • 2
  • 1
    This worked for me, should be marked as answer :) The problem was indeed the space in Program Files – yuudachi Jul 13 '11 at 22:31
  • 2
    Since I'm calling emulator.exe from the command line, I also have to change the Path variable. And to fix launching from the AVD Manager, call "C:\PROGRA~2\Android\android-sdk\SDK Manager" from the command line instead of using the shortcut. – Timothy003 Jul 14 '11 at 16:50
  • 1
    Confirmed that this is the issue on after update on mine as well, moved SDK and changed path, the 8.3 solution works as well. – Idistic Jul 27 '11 at 17:02
27

Same problem for me, though this is my first time trying to work with Android SDK in general. I believe the problem is with the location of the SDK. Note the "paramater" "Files\Android\android-sdk\tools/emulator-arm.exe." I believe there is a bug in google's code where it doesn't have the directory the SDK is located in in quotes, meaning, if there is a space anywhere in the directory name, it won't work. Can someone with their SDK in a directory with no spaces confirm my theory?

To work around the issue, you can call "C:\Program Files\Android\android-sdk\tools\emulator @foo" from the command line, where "foo" is the name of your emulator.

Chris Comeaux
  • 55
  • 1
  • 1
  • 6
Highsight
  • 391
  • 2
  • 4
6

I got this problem just now, and I found a solution.

My path to the emulator-arm.exe is C:\Program Files\Android\android-sdk\tools. When I try emulator-arm @my_avd from the command line (my_avd is my Android Virtual Device name), it works.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user822211
  • 343
  • 1
  • 6
  • 15
4

I fixed this problem on Windows XP. Just cut from "C:\Program Files\Android\android-sdk" and paste content directory to "C:\Android\android-sdk". Set my system varaible 'ANDROID_HOME'="C:\Android\android-sdk". Set path to Android SDK in Eclipse as "C:\Android\android-sdk". That's it! Everything works fine.

Mr. Cat
  • 3,522
  • 2
  • 17
  • 26
3

Since the cause of this issue is the space within filepath names of the Windows install directory then another workaround is to use the file short names (i.e. 8.3 alias filenames).

Specifically, if root install directory for Android SDK is

c:\Program Files\.. then use c:\PROGRA~1\..

or if

c:\Program Files(x86)\.. then use c:\PROGRA~2\..

You can then launch the SDK Manager via the command-line by running:

start c:\PROGRA~2\Android\android-sdk\tools\android.bat

Ray
  • 187,153
  • 97
  • 222
  • 204
3

Fixed in r13. Update your SDK Tools!

Timothy003
  • 2,348
  • 5
  • 28
  • 33
2

I think you are saying you changed the minSDK version of your app and now the emulator wont run...? this is because your emulator is the wrong version... assuming you changed the minSDK of your app correctly, all you need to do is create a emulator with the same SDK version. Open the Android SDK / AVD manager (icon top right of screen next to print token) and create a emulator with minSDK 12.

Adam Storm
  • 724
  • 1
  • 6
  • 13
2

Moving your Android SDK folder to somewhere that the complete path will be without white spaces will fix the problem.

Peter Fortuin
  • 5,041
  • 8
  • 41
  • 69
2

I also got this problem after updating SDK Tools from revision 11 to 12. I found it was a problem with a space in the upper directory name where android-sdk-windows resides, then I copied both 'eclipse' and 'android-sdk-windows' directories from my 'Program Files (x86)' to the root of drive D:. All is solved now!

Jagoliveira
  • 515
  • 3
  • 5
1

As an alternative to PROGRA~2 method (which is not working for example in Intellij IDEA), you can create a symlink named, for example, prg to Program Files (run mklink /? from command line to learn how to do it), then run emulator as C:\prg\Android\android-sdk\tools\emulator.exe. Change path to SDK/emulator in your IDE also.

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:32
0

I had a same problem when I setup r12. I found out this problem was caused by blank spaces in the path you setup android SDK. The solution is that you should move the folder of android SDK to a place without spaces, in your case : E:\andriod-sdk or D:\abc\xyz\android-sdk.

Hung Tran
  • 1,595
  • 2
  • 17
  • 17