The Android emulator is not starting, showing "invalid command-line parameter"

AndroidAndroid Emulator

Android Problem Overview


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?

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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.

Solution 3 - Android

  • 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

Solution 4 - Android

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.

Solution 5 - Android

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.

Solution 6 - Android

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.

Solution 7 - Android

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.

Solution 8 - Android

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.

Solution 9 - Android

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!

Solution 10 - Android

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

Solution 11 - Android

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMaxView Question on Stackoverflow
Solution 1 - AndroidNickCView Answer on Stackoverflow
Solution 2 - AndroidsuperjosView Answer on Stackoverflow
Solution 3 - AndroidJorgesysView Answer on Stackoverflow
Solution 4 - AndroidCaltorView Answer on Stackoverflow
Solution 5 - AndroidScottView Answer on Stackoverflow
Solution 6 - AndroidRichardTheKiwiView Answer on Stackoverflow
Solution 7 - AndroidPhil ManzanoView Answer on Stackoverflow
Solution 8 - AndroidDmitry OsinovskiyView Answer on Stackoverflow
Solution 9 - AndroidmarisxanisView Answer on Stackoverflow
Solution 10 - AndroidfuryView Answer on Stackoverflow
Solution 11 - AndroidApehelView Answer on Stackoverflow