Phonegap 构建失败,退出代码 2 [英] Phonegap build fails with exit code 2

查看:25
本文介绍了Phonegap 构建失败,退出代码 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 phonegap,当我尝试使用以下命令构建项目时遇到了这个问题;phonegap 构建安卓"

I just freshly installed phonegap and having this problem when I try to build the project with the following command ; "phonegap build android"

ANDROID_HOME : C:\Android\sdk

ANT_HOME : C:\apache-ant-1.9.4\

JAVA_HOME : C:\Program Files\Java\jdk1.8.0_45\

详细的控制台日志如下;

The detailed console log is as follows ;

Error : executing command 'ant' , make sure you have ant installed and added to your path. 
Command finished with error code 2: cmd ....\android\cordova\build.bat.
Error building one of the platforms. Error : cmd : command failed with exit code 2. 
You may not have the required environment or OS to build this project.

所以它基本上说 ANT 不工作.当我在命令提示符中键入 ANT 时,它说无法识别 ant.%ANT_HOME/bin/ant 可以工作.

So it basically says that ANT is not working . When I type ANT into command prompt, it says ant is not recognized. %ANT_HOME/bin/ant works though.

当我执行以下 ANT 命令时,无法识别 phonegap.

When I do the following ANT command works but then phonegap is not recognized.

set  PATH=%BASEPATH% 
 set ANT_HOME=C:\apache-ant-1.9.4\
 set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45\
 set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%

知道如何解决吗?

推荐答案

好吧,太烦人了.
在我的应用程序文件夹中,我确实发出了以下命令.

Well it is so annoying.
In my app folder I did issue the following commands.

set ANT_HOME=C:\apache-ant-1.9.4\
set PATH=%PATH%;%ANT_HOME%\bin

然后 phonegap 命令也能正常工作.除非我发出上述命令,否则根本无法解决 ANT.尝试 ANT 命令工作花了几个小时,但根本没有灯.即使它被定义为环境变量,它也根本不起作用.

And then the phonegap command works as well. Simply ANT is not resolved unless I issue the aforementioned commands. It took hours to try ANT command work but no light at all. It is simply not working even though it is defined as env variable.

如果每次发出 phonegap build 命令时都会遇到 minSDK 错误(在我将 phonegap 版本升级到 5.0 后,这种情况一直发生在我身上.0) ,请记住编辑 manifest.xml 不会有什么不同,因为它被 build 命令编辑回其原始形式.您需要做的是更改 www/config.xml 文件中的 minSDK 版本.

Edit : If you also end up with the minSDK error each time you issue the phonegap build command ( which keeps happening for me right after I upgraded phonegap version to 5.0.0) , please keep in mind that editing manifest.xml wont make a difference because of the reason that it is edited back to its original form by the build command. What you need to do is to change the minSDK version in the www/config.xml file.

这篇关于Phonegap 构建失败,退出代码 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆