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

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?

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.

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.

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\.

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.

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.

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.

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.

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.

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!

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

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.

Related

Is this Android Studio bug or am I doing wrong?

I have android studio setup on my Ubuntu machine and now whenever I try to start the emulator, it throws exception like:
Cannot launch AVD in emulator.
Output:
PANIC: Could not find
Nexus_S_API_21.ini file in $ANDROID_AVD_HOME$ nor in $HOME./android/avd
So when I do:
echo $ANDROID_AVD_HOME
It shows empty which means that this path is not set and when $HOME is my /home/user
So when I go in /home/user/.android/avd there is really no .ini file. So, I am confused, when I create a virtual device, where does it go? How can I find the path where virtual devices are being created and if possible, how can I change the path to create virtual devices?
You can find location of your avd's *.ini files in AVD Manager (GUI).
Right under tab "Android Virtual Devices" there is line "List of existing Android Virtual Devices located at %here is the location%".
You can try to change system variable %android_avd_home% to something like /home/user, for example and then restart IDE (Android Studio).
Also, you can try to find useful information here: https://code.google.com/p/android/issues/detail?id=78577
Hope it helps
I experienced this same issue on OSX, but the weird part was it only happened after I had added the ANDROID_SDK_HOME varible to my environment.
I experimented and found that if I added the ANDROID_AVD_HOME variable to my environment or I removed ANDROID_SDK_HOME, it caused it to start working.
One solution at this problem is to copy the file's emulator which exited and rename it in the name of the new emulator; that is say the android studio name of emulator who is try to run.
NB : Before I suppose you had install the eclipse ADT which contains one or some emulator
Example :
1) cd .android/avd/
2) ls -al
3) cp .ini .ini
4) Finish run the emulator in your android studio by the AVD
This happens on Windows when the user home folder is changed from the default one. To make Android Studio happy just add a system enviroment variable and set it to your home folder, for example:
ANDROID_SDK_HOME = D:\Users\max\

Could not find INI file in $ANDROID_AVD_HOME nor in $HOME/.android/avd

I cannot start a virtual devices on android SDK when I press the start button on AVD manager, this error shows on my screen:
Starting emulator for AVD 'AVD_for_Galaxy_Nexus_by_Google'
PANIC: Could not find AVD_for_Galaxy_Nexus_by_Google.ini file in
$ANDROID_AVD_HOME nor in $HOME/.android/avd"!
Here is the screen shot:
You'll just have to set the ANDROID_AVD_HOME environment variable and restart Android Studio.
just this command worked for me : sudo cp -R /root/.android $HOME
I solved this problem, on Ubuntu, by finding where the .avd and .ini files from the AVD manager were downloaded. By default, these are named after the virtual device created in the AVD manager and will be like this: Nexus_4_API_22.ini and will have a .ini and .avd file both with the same name. In my case, they were located in /root/.android/avd/.
From there, I copied both the ini and avd files of the virtual device (If you have more than one, copy all of the virtual devices you want) into $HOME/.android/avd/, as that is one of the locations the message requested. On linux, sudo cp /root/.android/avd/Virual_Device_XX.ini $Home/.android/avd/ and do the same with the .avd file. Hope this helps anyone who runs into this issue.
For me the Environment variable was missing altogether.
adding "ANDROID_AVD_HOME" as environment variable solved it.
also a tip, enter the path without the "/.android/avd" part, as the application automatically adds this to it's search you don't need to specify them anymore.
e.g.
Env. Variable : ANDROID_AVD_HOME
Value : C:\users\%USERNAME%\Androidapps
Android studio will for emulators under C:\users\%USERNAME%\Androidapps.android\avd
Just create a symlink:
ln -s /root/.android/ /home/user/.android/
This way you will solve the issue with the emulator because all sdk data is being written on /root/.android/
Or instead ANDROID_AVD_HOME enter ANDROID_SDK_HOME and Studio will work: Cannot start avd emulator on android studio 1.0
I just encountered this problem again and realized that newer versions of Android Studio and SDK are placing AVDs along the following path for OSX:
Users/yourUsername/Library/Android/sdk/.android/avd as opposed to the older practice of placing AVDs here: Users/yourUsername/.android/avd
So, I just updated my bash_profile file to point ANDROID_AVD_HOME to the new location--which did indeed contain the ini file for the AVD I'd created, and then the launch went fine.
because android SDK environment ANDROID_SDK_HOME, wrong path. /usr/local/opt/android-sdk or /Users/[userName]/Library/Android/sdk TRUE
Make sure your ANDROID_SDK_HOME or ANDROID_AVD_HOME is defined correctly and AVD is installed in AVD Manager.
You can get the avd folder path by clicking view details of any AVD you have installed.
Directories are searched by emulator in the order $ANDROID_AVD_HOME, $ANDROID_SDK_HOME\avd and $HOME.android\avd .
Check whether the avd folder path matches any of the above path. Make sure there is no empty avd folder in any of the above path of defined environment variables.
Try changing the environment variable definition from ANDROID_AVD_HOME to $ANDROID_AVD_HOME.

"PANIC: Could not open" while trying to run Android emulator on Linux Mint

I installed Eclipse Kepler and the Android development tools. Everything is working fine, except for when I try to run my Android code in an emulator I get the following error:
Emulator] PANIC: Could not open: [name of Android virtual device]
I Googled the problem but I have not found a solution. It might have to do with the Android path or perhaps authorizations, but I do not know where I have to change them to.
I hope someone can help me out.
This has been asked a few times already, try this:
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.
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.
Original answer by: Colin Pickard
To change the ANDROID_SDK_HOME variable in Ubuntu (as requested in the comment):
Edit your .profile file with a command like gedit ~/.profile and append the following to the end of the file:
export ANDROID_SDK_HOME=/your/android-sdk/path/here
Here's a list of some variables you can modify for Android Tools.
export PATH=${PATH}:~/android-sdk-linux_x86/tools
export PATH=${PATH}:~/android-sdk-linux_x86/platform-tools
export ANDROID_SDK_HOME=~/android-sdk-linux_x86/tools
export PATH=$PATH:$ANDROID_SDK_HOME
Similar Questions
Android Emulator can't start, 'cause of wrong folder
I have problem in a emulator
android emulator error:[2011-08-02 11:14:01 - Emulator] PANIC: Could not open: C:\Users\hallo\.android/avd/myemu.ini

AVD - PANIC: Could not open... - not a path issue

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.
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.
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.
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 :)
I fixed the AVD Panic issue by running Eclipse as an administrator.
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
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.
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
try to add new windows admin user with English language only
it worked for me
the user name should be in English letters
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
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.
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**"

android emulator error:[2011-08-02 11:14:01 - Emulator] PANIC: Could not open: C:\Users\hallo\.android/avd/myemu.ini

I am beginner android application developer. I have done lot of apps in eclipse on emulator and device also. But now it is giving error at the time of running project on emulator. It is working on device phone but on emulator it is giving following error:
[2011-08-02 11:14:00 - hello1] ------------------------------
[2011-08-02 11:14:00 - hello1] Android Launch!
[2011-08-02 11:14:00 - hello1] adb is running normally.
[2011-08-02 11:14:00 - hello1] Performing com.mahiways.Hello1.Hello1Activity activity launch
[2011-08-02 11:14:00 - hello1] Automatic Target Mode: launching new emulator with compatible AVD 'myemu'
[2011-08-02 11:14:00 - hello1] Launching a new emulator with Virtual Device 'myemu'
[2011-08-02 11:14:01 - Emulator] PANIC: Could not open: C:\Users\hallo\.android/avd/myemu.ini
How can I solve this problem?
This is a bug in the ADT Plugin. For a workaround until it is fixed use a NTFS symbolic link.
I have a C: drive for windows 7 and a D: drive for all my work and data. After installing windows 7 I relocate all my special folders from C:\Users\John Doe to D:\John Doe. The ADT Plugin is trying to load the emulator from C: when it and the configure files are on D: (PANIC: Could not open etc.). NTFS can get the ADT Plugin to read from D: using a NTFS symbolic link. Open a command prompt in C:\Users\John Doe (obviously use your user name), use the mklink command.
mklink /J "C:\Users\John Doe\\.android" "D:\John Doe\\.android"
Now when the ADT plugin is trying to reference .android on C:, NTFS sends the request to D: and the emulator starts correctly.
I was having this problem also but finally found a solution.
What you need to do is:
1. Create a new Windows system variable called ANDROID_SDK_HOME and set it to the directory of your Android SDK installation
2. In your "eclipse\configuration.settings\org.eclipse.ui.ide.prefs" file, also add a definition for ANDROID_SDK_Home
Then, all of your AVD files will be created in your "android-sdk/.android/avd" folder
Solution is as follows:
Set the environment variable: ANDROID_SDK_HOME value of your SDK directory. As I have is: variable name ANDROID_SDK_HOME value of the E:\java\androidsdk
Modify the configuration file in the eclipse installation directory. Locate the following files: eclipse \ configuration.settings \ opened of org.eclipse.ui.ide.prefs, in a later supplement to change just to configure the environment variables.
As I add is: ANDROID_SDK_Home = E\:\\java\\androidsdk (Note that the slash format)
Restart eclipse, reconstruction of the AVD can be run successfully.
The configuration files for your emulator might have been saved by AndroidSDK and AVD Manager some where else in your hard drive.
Do the following:
First search for the .android folder on you harddisk.
After you find that, move the .android folder to your user root directory - which may be "C:\Users\hallo\" in your case.
These type of project creation errors(with cause and solution) is described here.
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.
It should work now.

Categories

Resources