Iam遵循指南在PhoneGap上创建我的第一个项目,我想在Android模拟器上运行它。所以我输入了
phonegap run android
加载了一些东西但是我收到了以下错误:
C:\Users\Thomas\form>phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
C:\Users\Thomas\.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\Thomas\.cordova\lib\android\cordova\3.5.0\bin\lib\check_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:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Comm
and failed with exit code 8] code: 8 }
[error] C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Com
mand failed with exit code 8
编辑:
按照说明后我安装了ant并且不再出现错误。但仍有一些其他错误:
C:\Users\Thomas\form>phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js:87:29
at _rejected (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:808:24)
at C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:834:30
at Promise.when (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:752:41)
at C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:574:44
at flush (C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13){ [Error: C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8] code: 8 }
[error] C:\Users\Thomas\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
EDIT2:好的,我解决了这个问题。我需要安装JAVA JDK,Android SDK并分配一些环境变量......
祝你好运
答案 0 :(得分:2)
您需要从http://ant.apache.org/bindownload.cgi
手动下载ant
然后在某处提取它。假设在驱动器D:\apache-ant-1.9.3
接下来添加环境变量ANT_HOME
及其值D:\apache-ant-1.9.3
最后将其添加到路径变量%ANT_HOME%\bin
不要忘记重启终端或命令提示符
答案 1 :(得分:0)
这似乎是一个普通的错误,没有太多的描述本身。对我来说,如果我仅使用VS 2015 RC Cordova项目将应用程序配置设置为纵向,我一直看到此构建错误。