Java Phone Gap [error] cmd: 命令失败,退出代码为 ENOENT
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22312332/
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
Phone Gap [error] cmd: Command failed with exit code ENOENT
提问by user3403739
I am trying to get phone gap to work on android and my command outputs the following:
我正在尝试让手机间隙在 android 上工作,我的命令输出以下内容:
phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] cmd: Command failed with exit code ENOENT
When searching this error message I get a lot of hits, but everyone else seems to have much more verbose error messages, when this is all I get. Even with the -d or -v option that is what I get.
在搜索此错误消息时,我得到了很多点击,但其他人似乎都有更详细的错误消息,而这就是我得到的全部。即使使用 -d 或 -v 选项,这也是我得到的。
I am using Windows 7 x64
我使用的是 Windows 7 x64
My PATH variable looks like this:
我的 PATH 变量如下所示:
%JAVA_HOME%\bin;C:\Users\Mike\AppData\Roaming\npm;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%ANT_HOME%\bin;C:\Program Files\nodejs;
%JAVA_HOME% , %ANDROID_HOME% and %ANT_HOME%
%JAVA_HOME% 、%ANDROID_HOME% 和 %ANT_HOME%
all lead to the correct places when I type them into my search bar.
当我将它们输入到我的搜索栏中时,所有这些都会指向正确的位置。
Just typing "java" and "ant" into my command line gives me results.
只需在命令行中输入“java”和“ant”即可得到结果。
Any ideas where I should start looking? Are there error logs somewhere?
我应该从哪里开始寻找任何想法?某处有错误日志吗?
回答by Mohammad Nurdin
You need to install ant before build.
您需要在构建之前安装 ant。
How to install ant? Use this one.
如何安装蚂蚁?用这个。
try this one. Make sure you install node.js first
试试这个。确保先安装 node.js
1.Download and install Homebrew by executing following command in cmd:
1.在cmd中执行以下命令下载并安装Homebrew:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
2.Install Apache Ant via Homebrew by executing
2.通过 Homebrew 执行安装 Apache Ant
brew install ant
3.Build project
3.构建项目
phonegap build android
回答by hdmartinez
If you are sure of yours paths try to type android
in cmd
if it says: 'xcopy' was not recognized
.
如果你是你的肯定路径尝试键入android
的cmd
,如果它说:'xcopy' was not recognized
。
then add to your path:
然后添加到您的路径:
%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;
回答by andreibosco
He is using Windows 7, brew is for OSX.
他使用的是 Windows 7,brew 适用于 OSX。
To install ANT for windows try this: https://code.google.com/p/winant/
要为 Windows 安装 ANT,请尝试以下操作:https: //code.google.com/p/winant/
回答by Desmond
I am not sure how this resolved the issue but try this out it will resolve for sure.
我不确定这是如何解决问题的,但试试这个肯定会解决。
This is due to ANT tools could not find tools.jarin JRE lib directory. When I copied tools.jar from JDK lib directory to JRE lib directory. Restart the system and the problem was absolutely solved and the build was successful when I ran the command "cordova -d platform add android". Hope this helps you.
这是因为 ANT 工具在 JRE lib 目录中找不到tools.jar。当我将 tools.jar 从JDK lib 目录复制到 JRE lib 目录时。重新启动系统,问题完全解决,当我运行命令“cordova -d platform add android”时构建成功。希望这对你有帮助。
回答by user495285
I'm using cordova and the following worked for me:
我正在使用cordova,以下内容对我有用:
cordova platform rm android
cordova platform add android
After this refresh eclipse acted a bit wonky just remove and add the project back again.
在这个刷新 eclipse 表现得有点不稳定之后,只需删除并再次添加该项目。
回答by user1738092
Please add C:\Windows\System32 in your PATH variable. It worked for me!
请在您的 PATH 变量中添加 C:\Windows\System32。它对我有用!
回答by dunet roi
Try to delete this folder :
尝试删除此文件夹:
%USERPROFILE%\.gradle