Cordoba add platform - Error executing 'ant' command

At the beginning..

I know this question has been asked too many times and ... I checked all the ansers on SO. I tried every combination and every solution I found, but so far nothing has worked.


Problem

I have successfully installed Cordova by downloading it from the official website, and I am following the Guide.

I added the wp8 platform in the first place. Then I also tried to add android.

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

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

Here is a screenshot with detailed information:

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


My efforts

I installed ANT, the latest Java JDK, and added all the necessary Enviroment variables to my system.

ANT and JAVA both execute perfectly from any source path.

ant -version outputs

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

java -version outputs

HotSpot (TM) 64-bit Java Server Virtual Machine (build 25.5-b02, mixed mode)


Environment Variables

I set 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 sees, I also added android platform-tools and tools to my PATH . The same goes for Ant and Java (\ bin dirs).

Needless to say, but every path is right.


Having said that, why is it still not working? I also restarted my computer, but without any results.


Decision

Thanks Kerri Shotts .

My problems were from those gaps in my ways.

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

IMPORTANT!

I also noticed that there were 2 β–‘ characters in my lines. Like this ..\Cβ–‘β–‘ellulare\.. They probably came from the wrong copy-paste format. After fixing these things, everything worked!

+6
source share
1 answer

Due to the nature of the languages, gaps are filled in some, but are ignored in others. Using a file name such as "Program (whitespace) Files" creates compilation errors from \ bin directories. The next time you declare an environment variable, make sure your folder does not contain spaces or spaces between different names. FYI: camelCase scripts in which the entered towing works around this concept. Thank you

+1
source

Source: https://habr.com/ru/post/969464/


All Articles