cordova添加平台 - 执行命令'ant' [英] cordova add platform - Error executing command 'ant'

查看:168
本文介绍了cordova添加平台 - 执行命令'ant'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开始..



我知道这个问题已被问过太多次和..我检查了所有ansers上SO。尝试每个组合和每个解决方案,我发现,但没有什么为我工作到目前为止。






问题



我已成功安装cordova下载它从官方网站,我一直遵循指南。



我已成功添加 wp8 平台



执行命令 cordova platform add android 后,我得到以下错误:执行命令'ant',请确保您已安装ant并添加到您的路径。

  

以下是更多详细信息的屏幕截图:








我的努力



我安装了ANT,最后一个Java JDK并将所有必要的环境变量添加到我的系统中。



ANT和JAVA都可以从任何源路径执行。



ant -version 输出


Apache Ant 2014年4月29日汇编


java -version 输出


Java HotSpot™64位服务器VM(构建25.5-b02,混合模式)







环境变量



我已经设置了每个必要的变量。从ANT_HOME到PATH。一切都应该如此

  ANT_HOME:C:\Program Files \Ant 

JAVA_HOME :C:\Program Files\Java\jdk1.8.0_05

ANDROID_HOME:C:\Users\Kevin\Desktop\Cellulare\Development\sdk

PATH:%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;

大家都可以看到,我也添加了android platform-tools tools 到我的 PATH 。同样的事情对于Ant和Java(\bin dirs)。



不用说,但每个路径都是正确的。






有这些事情,为什么这还是不行?我也重新启动了我的电脑,但没有结果。






解决方案



感谢 Kerri Shotts



我的问题来自于



所以我将 C:\Program Files\ ... 更改为 C:\Progra〜1 \ ...



我也注意到有2 字符串。喜欢这个 .. \C□□ellulare \ .. 。他们可能来自一个错误的复制粘贴格式。

解决方案

由于语言的本质,空格在某些语言中执行,而在其他语言中则被忽略。
从\bin目录编译时,使用诸如Program(whitespace)Files这样的文件名不会产生错误。
下次您声明环境变量时,请确保您的文件夹不包含任何空格或各个名称之间的间隙。
FYI:camelCase脚本,其中介绍了拖拉这个概念。
谢谢。


In the beginning..

I know that this question has been asked way too many times and.. I checked all ansers on SO. Tried every combination and every solution I found but nothing has worked for me so far.


The problem

I've succesfully installed cordova downloading it from the official site and I've been following the Guide.

I've added wp8 platform succesfully first. Then I tried to add android as well.

After executing the command cordova platform add android, I got the following error.

Error: executing command 'ant', make sure you have ant installed and added to your path.

Here's a screenshot with more details:


My efforts

I've installed ANT, the last Java JDK and added all necessary Enviroment Variables to my System.

ANT and JAVA both gets executed fine from any source path.

ant -version outputs

Apache Ant(TM) version 1.9.4 compiled on April 29 2014

java -version outputs

Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)


Enviroment Variables

I've set up every necessary variable. From ANT_HOME to PATH. Everything is as it should be

ANT_HOME: C:\Program Files\Ant 

JAVA_HOME: C:\Program Files\Java\jdk1.8.0_05

ANDROID_HOME: C:\Users\Kevin\Desktop\Cellulare\Development\sdk

PATH: %JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools; 

As everyone can see, I've also added android platform-tools and tools to my PATH. Same thing for Ant and Java (\bin dirs).

Needless to say but every path is correct.


Having this things said, Why this still doesn't work? I've also restarted my PC as well but with no results.


Solution

Thanks to Kerri Shotts.

My problems were from those spaces in my paths.

So I changed C:\Program Files\... to C:\Progra~1\....

IMPORTANT!

I also noticed there were 2 characters in my strings. Like this ..\C□□ellulare\... They probably came from a wrong copy-paste format. After fixing these things everything worked!

解决方案

Due to the nature of languages, whitespaces are executed in some whilst ignored in others. Utilizing a file name such as "Program(whitespace)Files" does produce errors when compiling from \bin directories. Next time you declare an environmental variable, be sure that your folder does not contain any whitespaces or gaps between the various names. FYI: camelCase scripts where introduced tow work around this concept. Thanks.

这篇关于cordova添加平台 - 执行命令'ant'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆