Android simple program run error - android

I have just installed Android SDK to my Eclipse, but when I run a simple program on Eclipse I get following error.
[2012-05-02 11:15:11 - Emulator] invalid command-line parameter: and.
[2012-05-02 11:15:11 - Emulator] Hint: use '#foo' to launch a virtual device named 'foo'.
[2012-05-02 11:15:11 - Emulator] please use -help for more information
I added ADT plugin to Eclipse and also set path for Android SDK as
C:\Documents and Settings\ganesh\android-sdk_r12-windows\android-sdk-windows
Where did I go wrong?
Thanks
Ganesh.

Android sdk path can't contain any spaces.So your path
C:\Documents and Settings\ganesh\android-sdk_r12-windows\android-sdk-windows is wrong.
Put your sdk in a path like c:\android-sdk that containes no space.

I second Rasel, another workaround is changing the "SDK Location" in the Android Preferences in Eclipse to its corresponding 8dot3 directory name, As here "Documents and Settings" is causing the problem, change it to its corresponding 8dot3 directory name, that would probably be DOCUME~1 so the comple path would be
C:\DOCUME~1\ganesh\android-sdk_r12-windows\android-sdk-windows
If you don't know the 8dot3 name of your desired path, just use command prompt and execute "DIR /X"

Its a very commmon issue and a bug with Android SDK. "Documents and Settings" have spaces and it breaks it.
You have 2 options
Re-Install SDK and avoid having spaces in the folders.
instead of Documents and Settings replace it with DOCUME~1 if not then DOCUME~2 (some dos path)
e.g. C:\DOCUME~1\ganesh\android-sdk_r12-windows\android-sdk-windows
I hope you'd like the secound option as you don't have to re-install SDK again. It works for me.

Related

Android SDK location should not contain whitespace, as this cause problems with NDK tools

Recently I have installed the last version of Android Studio (Android Studio 2.1), keeping the old 1.2 version previously installed. Now i have Android Studio 2.1 and Android Studio 1.2. In Android Studio 1.2 when I click on SDK Manager it works properly, but in Andorid Studio 2.1 this problem appears:
how can I fix keeping the two versions of Android studio? Thanks
As the warning message states, the SDK location should not contain whitespace.
Your SDK is at C:\Users\Giacomo B\AppData\Local\Android\sdk. There is a whitespace character in Giacomo B.
The easiest solution is to move the SDK somewhere else, where there is no space or other whitespace character in the path, such as C:\Android\sdk. You can point both Android Studio installations to the new location.
There is another way:
Open up CMD (as Administrator)
Type: mklink /J C:\Program-Files "C:\Program Files" (Or in my case mklink /J C:\Program-Files-(x86) "C:\Program Files (x86)")
Hit enter
Magic happens! (Check your C drive)
Now you can point to C:\Program-Files (C:\Program-Files-(x86)).
just change the path:
"c:\program files\android\sdk" to "c:\progra~1\android\sdk"
or
"c:\program files (x86)\android\sdk" to "c:\progra~2\android\sdk"
note that the paths should not contain spaces.
It is possible to make a symbolic link from e.g. C:\Android\sdk to the actual location of the sdk (which contains whitespaces), and refer to this symbolic link from within Android Studio as the location of the SDK. I have, however, not tried whether NDK will work with such a setup, even though Android Studio stops giving this warning about whitespaces.
As long as you aren't using the NDK you can just ignore that warning.
By the way: This warning has nothing to do with parallel installations.
Simply....If you are not using NDK, there is no problem at all. On the other this is just warning not an error. With warning you can go ahead but not errors. Any it's better to adjust the whitespaces.
E.g if your SDK is at C:\program file\Android studio. There is a whitespaces "program file".
There are 2 simple methods:
1. Remove the whitespaces
2. Install at another location which don't have whitespaces.
I have the same error, make some change in the path C:\Users\Juan Jose\App---- to
C:\Users\JUAN~1\App.
CMD Command (Windows) go to root c:\Users
Type de command DIR /X
Here show a Short name of Juan Jose
Reemplace the name Juan Jose with the Short Name give it.
Copy your SDK folder and paste it in another folder without spaces (for example: "D: / Android / Sdk"), then open the SDK Manager, and change the Android SDK Location to the location of your new SDK folder
Just change
C:\Users\Giacomo B\AppData\Local\Android\sdk
to
C:\Users\Giacomo_B\AppData\Local\Android\sdk
I just wanted to add a solution for Mac users since this is the top article that comes up for searches related to this issue. If you have macOS 10.13 or later you can make use of APFS Space Sharing.
Open Disk Utility
Click Partition
Click Add Volume -- no need to Partition as we are adding an APFS volume which shares space within the current partition/container)
Give the volume a name (without spaces)
Click Add
You can now mount this drive like any other via Terminal: cd /Volumes/<your_volume_name>
Create an empty folder in the new volume -- I called mine sdk
You can now select the volume and directory while installing Android Studio
your sdk file path does not have whitespace like this./abc aaa/sdk it like ./abc_aaa/sdk this.
you know that this is does not do anything with your java and xml. It only affect the ndk which is for native apps or to use c++/c. so if you are just using java and xml or even kotlin there is no side effect with that thing
Just remove white space of all folders present in the given path for example Program Files
You can remove it by following steps->
Open elevated cmd,
In the command prompt execute:
mklink /J C:\Program-Files "C:\Program Files"
This will remove space and replace it with "-".
Better do this with both sdk and jdk path.
This works :)

Android Emulator: invalid command-line parameter

When I launch my emulator, I get the following error:
invalid command-line parameter: Android Development\android-sdk_r12-windows\android-sdk-windows\tools/emulator-arm.exe.
Hint: use '#foo' to launch a virtual device named 'foo'.
please use -help for more information
But my emulator is mark as "A valid Android Virtual Device".
How should I solve this error?
UPDATE:
i just solved this problem.
See answer below.
check your sdk path. Make sure the path should not have an empty space like ..../my Sdk/sdk-windos/
It's my mistake that I named my folder "Android Development" where I have put my sdk. I realized that having a path that have an empty space between letters or words, like in my case "Android Development" have caused this error.
I just transferred my android sdk to another folder and make sure that i named it properly(without blank space), for example "Android_Development".
Remove the blank space from your SDK path by renaming the path(if blank space is there)
or give proper command
emulator -avd "avdname"
note: AVD must exist with name "avdname"
There is one more aspect to this problem. If RAM size is more than the AVD can get from system, the same error is thrown.

Unable to start an Android emulator

I've just installed Eclipse with fresh Android SDK and ADT on Windows 7 x64 Professional. I've created an emulator and tried to start it, but starting fails with this message:
invalid command-line parameter: Files.
Hint: use '#foo' to launch a virtual device named 'foo'.
please use -help for more information
When I create another emulator, it also fails to start with the same message. Can anyone provide a solution? Thanks in advance.
Change the path of Android SDK to make sure it has no spaces, for example use Progra~1 instead of Program Files.
Don't use a path that contains withespace for the SDK installation.
You can also try from command line:
emulator #foo
considering that your PATH includes the SDK installation directory.

I can't install a platform in eclipse

When I choose available packages and Click the repository site checkbox to display the components available for installation I get a line check box that says "some packages were found but are not compatible updates" from my sdk manager i have downloaded every package and have updated everything so I do not understand why there are NO Available packages?
also when I created an avd to see the emulator work I get the following message after I click launch
"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"
It appears the command line above has a forward slash instead of a back slash. Any thought on how to get this working
You should install the Android SDK in a folder that doesn't contain spaces...
Spaces make everything go wild...
invalid command-line parameter: Files\Android\android-sdk......
This error is reported because you installed the sdk in "Program Files" directory. Please make sure that you install the sdk in a folder without any spaces in the name.

Starting the Android emulator in SDK tools, revision 12

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?
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-
move installation directories to paths that do not contains spaces (as already mentioned)...
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.
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.
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.
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.
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
Fixed in r13. Update your SDK Tools!
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.
Moving your Android SDK folder to somewhere that the complete path will be without white spaces will fix the problem.
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!
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.
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.

Categories

Resources