Compile on windows 7 to platform "android" problem with "TOOLS\ANT"

This is a bug I’ve faced & fixed my self but I still post it here for people who might stuck with it.

I’m brand new to both Cocos-x framework & Cocos Creator. I’ve just learnt to use them 2 days ago.

Yesterday I tried building an android test project entirely using Cocos Creator & Cocos-x v3.9 Framework (Of course I’ve set up python, android_ndk & sdk before already).

It was OK with “Build” function, but the next step “Compile” stopped with an error (Found in “nativeLog.txt”):

Running '“C:\somePath\Cocos-xV3.9\TOOLS\ANT” clean release “…\build.xml”
Error: “C:\somePath\Cocos-xV3.9\TOOLS\ANT” is not recognized as internal or external command …

While “TOOLS\ANT” is a folder extracted from “Cocos-x Framework V3.9” for windows.

I’ve googling for hours but no one has faced this problem like me. All promising suggestions turned to tell me to set “Environment Variables” named “ANT_HOME” or “ANT_ROOT” or “Path”. But none of the suggestions did the trick.

So here is the solution I’ve made that kicked the rock:

Just copy all files in folder “\Tools\Ant\Bin” into its parent folder “\Tools” and things will works properly.
The problem is that “TOOLS\ANT” is a folder, after you move the files, “TOOLS\ANT” refers to “TOOLS\ANT.CMD”.

I don’t know why Cocos Creator Compiler tools doesn’t add “\Bin\Ant.cmd” to the “Ant Path” in “Cocos Creator --> Preferences --> Native Develope” - Maybe it’s a mistake.

@gadapchetvoi
I think there is a misunderstanding of the ANT Path in the preference panel of Creator. You should set it to the dirname of the executable ant command.

For example:
Ant is installed in C:\somePath\Cocos-xV3.9\TOOLS\ANT on your machine. Then the executable ant command is C:\somePath\Cocos-xV3.9\TOOLS\ANT\bin\ant.cmd or C:\somePath\Cocos-xV3.9\TOOLS\ANT\bin\ant.bat.
So the ANT path in the preference panel should be C:\somePath\Cocos-xV3.9\TOOLS\ANT\bin.

Hope it’s helpful!

I’ve tried to set the ANT_PATH to “C:\somePath\Cocos-xV3.9\TOOLS\ANT\bin” but Cocos Creator throw me an error “can’t find ‘\ANT\BIN’ inside the given folder”. It seemed that by default Cocos Creator tries adding “\ANT\BIN” to the end of the given value of ANT_PATH. So I HAVE TO set ANT_PATH as “…\TOOLS” instead of “…\TOOLS\ANT\BIN…”