Android 执行时命令行参数无效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3492676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Invalid command line parameter when Android executes
提问by Kandha
When I click the 'run as Android application' option, it shows the following error:
当我单击“作为 Android 应用程序运行”选项时,它显示以下错误:
[2010-08-16 16:56:35 - Emulator] invalid command-line parameter: http://hostname:port.
[2010-08-16 16:56:35 - Emulator] Hint: use '@foo' to launch a virtual device named 'foo'.
[2010-08-16 16:56:35 - Emulator] please use -help for more information
回答by Porfirio Mendez Ocampo
Apparently the problem are the spaces in the path, so just from:
显然问题是路径中的空格,所以只是从:
C:\Program Files\Android\android-sdk
C:\Program Files\Android\android-sdk
to:
C:\PROGRA~1\Android\android-sdk
到:
C:\PROGRA~1\Android\android-sdk
If you have a 64 bit system
如果您有 64 位系统
From:
C:\Program Files (x86)\Android\android-sdk
to:
从:
C:\Program Files (x86)\Android\android-sdk
到:
C:\PROGRA~2\Android\android-sdk
C:\PROGRA~2\Android\android-sdk
Under Windows->Preferences->Android Change the SDK Location as shown above.
在 Windows->Preferences->Android 下更改 SDK Location,如上图所示。
Translated from: http://satoriwd.com/astath/?p=11
回答by Andrew McGarry
I've been trying to solve this same problem for two days now, and I just found a solution which works for me:
我已经尝试解决同样的问题两天了,我刚刚找到了一个对我有用的解决方案:
Cut the 'Android' file folder from it's place in the 'Program Files' (or 'Program Files (x86)' if you use Windows 7) folder and paste it directly in the C:\ directory
从“Program Files”(或“Program Files (x86)”,如果您使用 Windows 7)文件夹中的位置剪切“Android”文件夹,然后将其直接粘贴到 C:\ 目录中
Your SDK file path should look like this:
您的 SDK 文件路径应如下所示:
C:\Android\android-sdk
C:\Android\android-sdk
Simple as that :D Now the Android debugger shouldn't worry about there being a space in the file path. Let me know if additional clarification is needed
就这么简单 :D 现在 Android 调试器不必担心文件路径中有空格。让我知道是否需要额外说明
回答by user853761
I was facing the same problem with Android when executing the emulator, and I found a solution right now. Please follow these steps:
我在执行模拟器时遇到了与 Android 相同的问题,我现在找到了解决方案。请按照以下步骤操作:
- Uninstall the SDK that you have already installed
- Create a folder in disc C
- Name it like Android
- Open it and create inside it a new folder, for me I named it PROGRA~1
- Execute the installation of your SDK to be installed in the folder created PROGRA~1
- 卸载已经安装的SDK
- 在C盘创建文件夹
- 像Android一样命名
- 打开它并在其中创建一个新文件夹,我将其命名为 PROGRA~1
- 执行安装你的SDK要安装在PROGRA~1创建的文件夹中
回答by jason
In the line that says invalid parameter. You need to get rid of all the spaces. I had the same problem - my path was something like jason/phone app/xyz
在说无效参数的行中。你需要摆脱所有的空间。我有同样的问题 - 我的路径是这样的jason/phone app/xyz
I changed the directory name to jason/phoneapp/xyz
and it worked. You need to change the actual name of the directory that the command line is referencing. Then you need to go into eclipse and go into Windows > Preferences and you will find it says phone app (in my case) and change this also to phoneapp, and all will be well.
我将目录名称更改为jason/phoneapp/xyz
并且它起作用了。您需要更改命令行引用的目录的实际名称。然后你需要进入 eclipse 并进入 Windows > Preferences,你会发现它说的是电话应用程序(在我的情况下)并将其更改为电话应用程序,一切都会好起来的。
Don't uninstall anything, and don't move files around because they will the rest of the SDK will eventually go looking for them and not be able to find them.
不要卸载任何东西,也不要移动文件,因为它们会被 SDK 的其余部分最终去寻找它们而无法找到它们。
回答by Peyman
i did the following and my problem was solved(MY PROBLEM:when i wanted to run an emulator from the AVD manager,i received the following error "invalid command-line parameter: Files. Hint: use '@foo' to launch a virtual device named 'foo'. please use -help for more information") i think its happens when in the path of android.exe (in the tools folder in android-sdk directory) any space exists (like C:/Program Files(x86)/... between Program and Files) So what did i do? -i deleted all virtual devices that have created. -copied the whole android-sdk folder somewhere else. -uninstalled and reinstalled SDK in another path without any spaces(like C:/Android/android-sdk) -i copied the contents of old sdk-android (which was copied before uninstalling) like platform tools and platforms folders to the new path.(you can download platform tools and platform(s) again from the avd manager but this waist time) it worked for me and i hope it works for you too. thanks
我做了以下事情,我的问题得到了解决(我的问题:当我想从 AVD 管理器运行模拟器时,我收到以下错误“无效的命令行参数:文件。提示:使用‘@foo’启动一个虚拟名为“foo”的设备。请使用 -help 获取更多信息”)我认为它发生在 android.exe 的路径中(在 android-sdk 目录中的工具文件夹中)任何空间存在时(如 C:/Program Files(x86) )/... 在程序和文件之间) 那么我做了什么?-i 删除了所有已创建的虚拟设备。- 将整个 android-sdk 文件夹复制到其他地方。- 在另一个没有任何空格的路径中卸载并重新安装 SDK(如 C:/Android/android-sdk) -i 将旧 sdk-android(卸载前复制)的内容如平台工具和平台文件夹复制到新路径。(您可以再次从 avd 管理器下载平台工具和平台,但这段时间)它对我有用,我希望它也对你有用。谢谢
回答by Mistress phePhe
I had this same exact error when I would try to launch the emulator from Eclipse. I had all my Android files in my documents to begin with, not my program files. I moved these files and still had the problem because of my user name having a space in it.
当我尝试从 Eclipse 启动模拟器时,我遇到了同样的错误。一开始我的文档中有我所有的 Android 文件,而不是我的程序文件。我移动了这些文件,但仍然有问题,因为我的用户名中有一个空格。
So I took the suggestion of Andrew McGarry and put my Android SDK folder in my C: directory and viola, problem solved...well after I redirected it in Eclipse obviously lol.
所以我接受了 Andrew McGarry 的建议,并将我的 Android SDK 文件夹放在我的 C: 目录和中提琴中,问题解决了......在我在 Eclipse 中重定向它之后,显然大声笑。
Just make sure that nothing in your SDK path has a space in it and you should be fine. You shouldn't have to uninstall or delete anything, and you probably won't have to move any files around either. Remember...no spaces in the entire path. =)
只要确保您的 SDK 路径中没有任何内容,您应该没问题。您不必卸载或删除任何内容,也可能不必移动任何文件。请记住...整个路径中没有空格。=)
回答by JDM
If you manually open the emulator from within the Android SDK then run the debugger it works too.
如果您从 Android SDK 中手动打开模拟器,然后运行调试器,它也能正常工作。
回答by vatsal
I've been trying to solve this same problem,and I just found a solution which works for me: @First i saw a file named adb_has_moved.txt.The contents of the file were "The adb tool has moved to platform-tools/
我一直在尝试解决同样的问题,我刚刚找到了一个对我有用的解决方案:@First 我看到一个名为 adb_has_moved.txt 的文件。该文件的内容是“adb 工具已移至平台工具/
If you don't see this directory in your SDK, launch the SDK and AVD Manager (execute the android tool) and install "Android SDK Platform-tools"
如果您在 SDK 中没有看到此目录,请启动 SDK 和 AVD 管理器(执行 android 工具)并安装“Android SDK Platform-tools”
Please also update your PATH environment variable to include the platform-tools/ directory, so you can execute adb from any location.
还请更新您的 PATH 环境变量以包含 platform-tools/ 目录,以便您可以从任何位置执行 adb。
" so i copied adb.exe from platform-tools to tools......BUT THAT DIDN'T WORKED OUTThen i tried the next solution that is to create a new device bt that also flopped removing old virtual devices and creating new one was also not working for me
“所以我将 adb.exe 从平台工具复制到工具......但没有奏效然后我尝试了下一个解决方案,即创建一个新设备 bt 也失败了删除旧虚拟设备并创建新设备一个也不适合我
SO i tried the solution belowand stated by many.i found it from a spanish blog.i dont knw spanish bt i do knw google translate.
所以我尝试了下面的解决方案,并由许多人陈述。我是从西班牙博客中找到的。我不知道西班牙语 bt 我知道谷歌翻译。
It seems the problem is the spaces in the path for example:C:\Program Files\Android\android-sdk
似乎问题是路径中的空格,例如:C:\Program Files\Android\android-sdk
CHANGE THIS TO C:\PROGRA~1\Android\android-sdk
将此更改为 C:\PROGRA~1\Android\android-sdk
It really worked out for me.
它真的对我有用。
回答by lukin
This trick doesn't work in IntelliJ. To solve it I moved the Android SDK to c:\android-sdk-windows.
这个技巧在 IntelliJ 中不起作用。为了解决这个问题,我将 Android SDK 移到了 c:\android-sdk-windows。
After that you still have to change the path to Android in IntelliJ of course: - right click on the module -> open module settings - go to: platform settings -> SDKs -> Android
之后你当然仍然需要在 IntelliJ 中更改 Android 的路径: - 右键单击模块 -> 打开模块设置 - 转到:平台设置 -> SDKs -> Android
Or delete the previous one and create a new one
或者删除之前的,创建一个新的
回答by Vinay
Delete your previous Virtual devices. Re create it. launch it.
删除您以前的虚拟设备。重新创建它。启动它。
Once the emulator is running, run your application.
模拟器运行后,运行您的应用程序。
Other wise, go to your run configuration and select the emulator you would like to run.
否则,请转到您的运行配置并选择您想要运行的模拟器。