在Phonegap中运行android的错误

时间:2014-06-21 07:36:29

标签: android cordova

我在安装Phonegap android软件包时遇到问题。我查看了其他stackoverflow问题,但我不清楚究竟是什么问题。我得到的错误代码是:

[phonegap] using the local environment
[phonegap] adding the Android platform...

C:\Users\chad\.cordova\lib\android\cordova\3.5.0\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\chad\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.j
s:47:27
at exithandler (child_process.js:643:7)
at ChildProcess.errorhandler (child_process.js:659:5)
at ChildProcess.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:807:12)
{ [Error: C:\Users\chad\.cordova\lib\android\cordova\3.5.0\bin\create.bat: C
ommand failed with exit code 8] code: 8 }
[error] C:\Users\chanukya\.cordova\lib\android\cordova\3.5.0\bin\create.bat:
Command failed with exit code 8

如果我们安装了android sdk和java jre并设置了它们的路径,我发现不需要安装apache int。如果你有任何线索,请告诉我。 安装ant并设置路径变量后如下所示。

ANT_HOME = C:\Program Files\apache-ant-1.9.4-bin\apache-ant-1.9.4
PATH = C:\Program Files\apache-ant-1.9.4-bin\apache-ant-1.9.4\bin;

给了我

Files was unexpected at this time.

如果路径变量有问题,有人可以告诉我。当我运行ant命令时,从cmd中添加更多内容

C:\Users\chan>if "C:\Users\chan" == "" goto homeDrivePathPre
C:\Users\chan>if exist "C:\Users\chan\antrc_pre.bat" call "C:\Users\chan\antrc_pre.bat"
C:\Users\chan>if "C:\Users\chan" == "" goto userProfilePre
C:\Users\chan>if "C:\Users\chan" == "C:\Users\chan" goto userProfile
Pre
C:\Users\chan>if "C:\Users\chan" == "" goto alpha
C:\Users\chan>if "C:\Users\chan" == "C:\Users\chan" goto alpha
C:\Users\chan>if "Windows_NT" == "Windows_NT"
C:\Users\chan>if "Windows_NT" == "WINNT"
C:\Users\chan>if "C:\apache-ant-1.9.4" == "" goto setDefaultAntHome
C:\Users\chan>if not _4 == _\ goto checkClasspath
C:\Users\chan>set _USE_CLASSPATH=yes
C:\Users\chan>rem CLASSPATH must not be used if it is equal to ""
Files was unexpected at this time.
C:\Users\chan>if ".;"C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip";C:
\Program Files (x86)\Java\jre7\lib\ext\QTJava.zip"=="""" set _USE_CLASSPATH=no

1 个答案:

答案 0 :(得分:0)

请安装Ant并在环境变量中设置Ant路径和SDK路径。还要确保您已更新SDK。

Cordova for android: An error occurred while listening android targets