简体   繁体   English

无法在Phonegap中添加Android平台

[英]Cannot add Android Platform in Phonegap

I want to create Android apps using Phonegap. 我想使用Phonegap创建Android应用。 I have installed nodejs, phonegap, cordova, eclipse and everything. 我已经安装了nodejs,phonegap,cordova,eclipse和所有东西。 But while trying to add android platform i am getting this error. 但是,在尝试添加android平台时,出现此错误。 After a lot of searching some says add 'ant' path to system variables. 经过大量搜索后,有人说将“ ant”路径添加到系统变量。 I have done that. 我已经做到了。 But may be i did wrong. 但是也许我做错了。 Tried a lot of times. 尝试了很多次。 Not working. 不工作 Here the error i am getting while trying to add android platform 这是我在尝试添加android平台时遇到的错误

C:\hello>cordova platform add android
Creating android project...

C:\Users\gijo\.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
    at C:\Users\gijo\.cordova\lib\android\cordova\3.5.1\bin\lib\check_reqs.js:47
:27
    at exithandler (child_process.js:644:7)
    at ChildProcess.errorhandler (child_process.js:660:5)
    at ChildProcess.emit (events.js:95:17)
    at Process.ChildProcess._handle.onexit (child_process.js:808:12)
Error: C:\Users\gijo\.cordova\lib\android\cordova\3.5.1\bin\create.bat: Command
failed with exit code 8
    at ChildProcess.whenDone (C:\Users\gijo\AppData\Roaming\npm\node_modules\cor
dova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

C:\hello>

In order to develop with PhoneGap, and for the system (Windows in your case) to recognize all the directories and all the files you installed, you indeed need to add those libraries to "variables" inside the System Properties. 为了使用PhoneGap进行开发,并使系统(在您的情况下为Windows)识别所有目录和已安装的所有文件,您确实需要将这些库添加到“系统属性”中的“变量”中。

Make sure you have the right path. 确保您具有正确的路径。 For example: 例如:

Variable name: JAVA_HOME Variable value: C:\\Program Files (x86)\\Java\\jdk1.6.0_39 变量名称:JAVA_HOME变量值:C:\\ Program Files(x86)\\ Java \\ jdk1.6.0_39

Variable name: ANT_HOME Variable value: C:\\Program Files (x86)\\WinAnt 变量名称:ANT_HOME变量值:C:\\ Program Files(x86)\\ WinAnt

I had the same problem but solved.The issue related with ant path.Set the path in system variables by this way. 我也遇到了同样的问题,但解决了。与ant path有关的问题。通过这种方式在系统变量中设置路径。 goto Environmentvariables->system variables->select path variable click edit and add your ant path after a semicolon. 转到环境变量->系统变量->选择path变量单击编辑,并在分号后添加您的ant路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM