even if i'm trying just a simple android "hello world" program. On debugging following problem popping up..
" the android emulator process has unexpectedly stopped running. the instance and2.2 (its the name of avd i hd created) is now stopped.
Reason:
The emulator process terminated unexpectedly: invalid command-line parameter: Files.
Hint: use'#foo' to launch a virtual device named 'foo'.
please use -help for more information"
it's probably because the path is in Program Files or something on Windows. Put the android sdk folder into a path without a space.
sdk path can't contain spaces.May be you changed your sdk path to somewhere like c:/program files/...Which contains spaces.Please place it in a directory which contains no spaces
Related
While trying to test the android app am creating with React native, I run into this error
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
I have the emulator(the AMD version) installed in the android studio.
How can I solve this problem
In your scenario before running react native application you need to create emulator using Android Studio. You can view official documentation about running application on device by here
Before running your project make sure you have installed adb drivers - More
First of all create AVD using Android Studio.
Open your project android folder using Android Studio.
1. Click AVD Manager from Android Studio
2. Click Create Virtual Device
3. Select your device from device list and click Next
4. Select the android os version from the available version list and click Next
5. On last keep default settings on device and click Finish
After that you can see your available android emulator device list from AVD Manager window.
* Before run your react native application make sure you have turn on and run the android emulator from android studio
After that run your project using react-native run-android
You can run the command adb devices to check if there is any device attached. It should list atleast one device for it to work
This also may be there is not enough space to run avd, make sure enoug space in hard disk. in my case freed atlest 9gb.
My answer is, If you have changed the directory of avds, you should set ANDROID_SDK_HOME environment variable to the parent directory of .android.
Here is the detail:
It seems like when you run "emulator -list-avds" in cmd, the result is empty. (be sure to first add "ANDROID_HOME" with value of your sdk directory to your user environment variable, and "%ANDROID_HOME%\emulator" in the Path too.)
After checking the official documents:
https://developer.android.com/studio/run/emulator-commandline#starting
It said:
"$ emulator -list-avds
When you use this option, it displays a list of AVD names from your Android home directory. Note that you can override the default home directory by setting the ANDROID_SDK_HOME environment variable: the root of the user-specific directory where all configuration and AVD content is stored. You could set the environment variable in the terminal window before launching a virtual device, or you could set it through your user settings in the operating system."
and in another page:
https://developer.android.com/studio/command-line/variables#envar
it said:
"Some older tools, such as Android Studio 4.3 and below, do not read ANDROID_USER_HOME. To override the user preferences location for those older tools set ANDROID_SDK_HOME to the parent directory you would like the .android directory to be created under."
So I guess the reason is "npx react-native run-android" will invoke "emulator -list-avds" to find the emulator. And "emulator" is really an older tools, so ANDROID_SDK_HOME environment variable is necessay.
And if all goes well, you really don't need to run android studio before run "npx reactive-native run-android".
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.
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 attempted to program my first app; "Hello World" and I already encountered a bug I cannot fix. When I run the program I get:
invalid command-line parameter: Files.
Hint: use '#foo' to launch a virtual device named 'foo'.
please use -help for more information
Does anyone know what this means and how I can fix it?
I think your main problem is you installed your android sdk in a path where there is a space in the address.If you install the sdk in "C:\Program Files\Android\android-sdk",then you will surely get that issue.Try to use any directory which does not contain any space in it like C:\Android\android-sdk .
Or try to run the AVD from the command line like this C:\Progra~1\Android\android-sdk.
Hope this will help you.
Today I have started with setting up of Android Development Environment using Eclipse for java developers, Android SDK and ADT Plugin on Windows 7 exactly following the steps given on http://developer.android.com/resources/tutorials/hello-world.html but I'm stuck in between. I have written HelloAndroid application in same way as described on this link but when I'm running this code then it is not working. Following errors are shown in red:-
[2011-07-11 23:25:36 - Emulator] invalid command-line parameter: Files.
[2011-07-11 23:25:36 - Emulator] Hint: use '#foo' to launch a virtual device named 'foo'.
[2011-07-11 23:25:36 - Emulator] please use -help for more information
It's a new bug. You have to install your android sdk to a path that doesn't contain spaces. So c:\program files\android would fail, try c:\android.
Alternatively, you could first run your emulator by browsing to your androidsdk\tools folder, and open a command prompt there. Then use
emulator #foo
where foo is your avd name.
(You can also ofcourse, if you have one, deploy the application on your android phone, generally faster and easier to use)