关于“cordova platform add android”的错误

时间:2014-07-11 09:36:54

标签: android cordova ant

我在phonegap中创建了一个应用程序,我到了创建android应用程序的阶段,我尝试从命令行安装,我总是收到此错误,这里是一个错误的例子,知道我已经安装了apache ant我在路径变量

中设置路径
    C:\Users\user\.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 added to your path.
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:47:27
    at exithandler (child_process.js:633:7)
    at ChildProcess.errorhandler (child_process.js:649:5)
    at ChildProcess.EventEmitter.emit (events.js:95:17)
    at Process.ChildProcess._handle.onexit (child_process.js:787:12)
Error: C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\node_modules\phonegap\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Process.ChildProcess._handle.onexit (child_process.js:802:5)

1 个答案:

答案 0 :(得分:1)

请按照以下步骤操作:

  1. here
  2. 下载Ant
  3. 将下载的文件解压缩到目录中。
  4. 将环境变量JAVA_HOME设置为Java环境,ANT_HOME设置为解压缩Ant的目录,并将${ANT_HOME}/bin (Unix)%ANT_HOME%/bin (Windows)添加到路径中。
  5. 检查Setup
  6. 来源链接:Installing Apache Ant

    希望这有帮助。