PhoneGap Android错误"create.bat exit code 8"



我按照指南在PhoneGap上创建了我的第一个项目,我想在Android模拟器上运行它。所以我输入

phonegap run android

加载了一些东西,但是我得到了以下错误:

C:UsersThomasform>phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:126
                    throw e;
                          ^
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
    at C:UsersThomas.cordovalibandroidcordova3.5.0binlibcheck_reqs.js:4
7:27
    at ChildProcess.exithandler (child_process.js:652:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Socket.<anonymous> (child_process.js:969:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)
{ [Error: C:UsersThomas.cordovalibandroidcordova3.5.0bincreate.bat: Comm
and failed with exit code 8] code: 8 }
   [error] C:UsersThomas.cordovalibandroidcordova3.5.0bincreate.bat: Com
mand failed with exit code 8
编辑:

按照说明安装了ant后,不再出现错误。但仍有一些其他错误:

C:UsersThomasform>phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:UsersThomas.cordovalibandroidcordova3.5.0binlibcheck_reqs.js:87:29
    at _rejected (C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:808:24)
    at C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:834:30
    at Promise.when (C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:1079:31)
    at Promise.promise.promiseDispatch (C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:752:41)
    at C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:574:44
    at flush (C:UsersThomas.cordovalibandroidcordova3.5.0binnode_modulesqq.js:108:17)
    at process._tickCallback (node.js:419:13){ [Error: C:UsersThomas.cordovalibandroidcordova3.5.0bincreate.bat: Command failed with exit code 8] code: 8 }
   [error] C:UsersThomas.cordovalibandroidcordova3.5.0bincreate.bat: Command failed with exit code 8
好吧,我解决了这个问题。我需要安装JAVA JDK, Android SDK并分配一些环境变量…

您需要从http://ant.apache.org/bindownload.cgi上手动下载ant

然后在某处提取它。假设在驱动器D:apache-ant-1.9.3

接下来添加环境变量ANT_HOME,其值为D:apache-ant-1.9.3

最后将此添加到路径变量%ANT_HOME%bin

不要忘记重新启动终端或命令提示符

这似乎是一个没有太多描述的通用错误。对我来说,如果我只使用VS 2015 RC Cordova项目将应用程序配置设置为肖像,我一直看到这个构建错误。

相关内容

  • 没有找到相关文章

最新更新