6

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:

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


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!

Community
  • 1
  • 1
Kevin Cittadini
  • 1,449
  • 1
  • 21
  • 30
  • Just pick in sky - try set path without shortcuts. – Astery May 18 '14 at 12:13
  • @Astery Doesn't work. Still same error – Kevin Cittadini May 18 '14 at 16:00
  • 1
    Might be those pesky spaces. Try using the 8.3 short filename trick (Something like C:\PROGRA~1\ANT...) – Kerri Shotts May 18 '14 at 20:49
  • @KerriShotts: `C:\Program~1\Java\jdk1.8.0_05\bin;C:\Program~1\Ant\bin;C:\Users\Kevin\Desktop\Cellulare\Development\sdk\platform-tools;C:\Users\Kevin\Desktop\Cellulare\Development\sdk\tools;` doesn't work. Still SAME error. That's ridiculous isn't it? – Kevin Cittadini May 19 '14 at 17:02
  • 1
    Make sure you use the correct 8.3 name -- "Program~1" is 9 characters, not 8. I can't tell you for certain what the 8.3 name will be, but a `dir /x` from `c:` should tell you what to use. – Kerri Shotts May 19 '14 at 20:12
  • @KerriShotts Gotcha! Yep, spaces caused that. And ALSO some "hidden characters" in my string. It's hard to explain but between two letters there were 2 characters. Of course they were hidden but moving the cursor with the arrows I found them. Now I'm dowloading API 19 but that error is gone. Man if you post it as an answer I give you what you deserve. So others can be helped too – Kevin Cittadini May 19 '14 at 21:03
  • Update ended up. Everything works! Thanks a lot. – Kevin Cittadini May 19 '14 at 22:19
  • 1
    One should also try this solution, which seems to have helped myself: http://stackoverflow.com/a/24684283/289912 – Vladius Aug 19 '14 at 12:27

1 Answers1

1

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.

NexusInk
  • 41
  • 3
  • Thanks for your contribution. Like in my case developers have to pay attention to "invisible" characters between words from a bad "copy-paste" behavior – Kevin Cittadini May 16 '16 at 09:08