我正在尝试设置一个phonegap项目,但我似乎无法向其添加平台。当我尝试添加android时,我得到以下错误信息:
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
at C:Usersspacitron.cordovalibandroidcordova3.4.0binlibcheck_reqs.js:4
7:27
at exithandler (child_process.js:643:7)
at ChildProcess.errorhandler (child_process.js:659:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:805:12)
Error: C:Usersspacitron.cordovalibandroidcordova3.4.0bincreate.bat: Command
failed with exit code 8
at ChildProcess.whenDone (C:UsersspacitronAppDataRoamingnpmnode_modulesco
rdovasrcsuperspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
这对我来说没有多大意义,因为当我运行"and -version"时,我得到以下内容:
Apache Ant<TM> version 1.9.4 compiled on April 29 2014
那么我在这里可能遗漏了什么呢?
当你出错时,它说找不到你的蚂蚁。您需要在环境变量
中添加pathPATH
; % JAVA_HOME % bin; % ANT_HOME % bin; % ANDROID_SDK %, % ANDROID_ADB %;
(也可以在about命令中添加绝对路径)
ANT_HOME
C:Program FilesJavaant
JAVA_HOME
C:Program FilesJavajdk1.7.0_25
ANDROID_SDK
C:Androidsdktools
ANDROID_ADB
C:Androidsdkplatform-tools
运行以下四个命令检查每件事是否正确设置
adb
android
javac
ant
创建项目命令移动到phonegap android文件夹。按Shift+右键,选择"在这里打开命令窗口"
create Path_to_Project Package_Name Project_Name
create C:UsersYourUsernameDesktop com.talha.test HelloWorld
1、2.