Hello everyone!
I’m new at cocos2dx, and I have followed this instruction http://www.sonarlearning.co.uk/coursepage.php?topic=game&course=cocos2d-x-v3 but it can’t work.
When i build my android project by cmd:
Building apk…
running: ‘“C:\Android\ANT\bin\ant” clean debug -f D:\hell\hell\proj.android\build.xml -Dsdk.dir=“C:\Android\SDK”’
The file name, directory name, or volume label syntax is incorrect.
Error running command, return code: 1.
I have no idea to fix this, can someone help me?
Thank for read.
thank for fast reply, but i have tried changing foward slashes vs backward slashes of variable value of ANT_ROOT many times and not work 
iQD
4
Are your paths correct?
Copy the command from above and try it by hand to see if it generates errors as well.
“C:\Android\ANT\bin\ant” clean debug -f D:\hell\hell\project.android\build.xml -Dsdk.dir=“C:\Android\SDK”
That cmd work correctly, but when i compile with cocos it has error.
Why???
iQD
6
Is it also working with the ’ an d the end and the beginning?
'"C:\Android\ANT\bin\ant" clean debug -f D:\hell\hell\proj.android\build.xml -Dsdk.dir="C:\Android\SDK"'
Of course not :-s It shows:
The file name, directory name, or volume label syntax is incorrect.
May be it is my problem? Hmm… I create project by “cocos new” then run by “cocos compile”, why can it happen to me? 
Do you have resolution for this?
Thank for spent time for me 
iQD
8
Then you now know, where the problem is.
Because you maybe set the ANT_ROOT wrong. Post your setting of the environment variable.
All environment variable settings have to be without quotes.
Hmm… I can’t see what wrong here: 

iQD
10
OK, this is all correct. It seems that your console is trying to execute the command, because the ticks are interpreted.
Maybe something with your python environment.
Which python version are you using? Which cocos2d-x version? Which Windows version?
Can you try to execute it directly with python, not from the batch file?
python cocos compile
Please also test it in your PowerShell:
cocos compile and also python cocos compile
I use Python 2.7, Cocos 3.7.1, Win 8.1 64bit.
I have not used python directly yet, this is what i tried:

iQD
12
Do not start the python interpreter. Just open your console and type:
python cocos.py compile -s D:/hell/hell -p android
iQD
14
Sorry, I ment cocos.py.
You have to execute this in the directory where the cocos console python script resides or use the full path of the cocos.py script.
It’s in <your cocos engine root folder>\tools\cocos2d-console\bin.
python cocos.py compile -s D:/hell/hell -p android
iQD
16
Then try the same in PowerShell, because it does escape ’ as well.
blaser
18
I followed the Sonar example a while back, the issue I ran into was not setting up JAVA_HOME in the env.
Have you added a JAVA_HOME variable to your environment variables? It should point to the JRE installation root i.e. C:\Program Files\Java\jre1.8.0_60
I added JAVA_HOME to env variables, but it can’t solve my problem 
blaser
20
I’m guessing you closed and restarted cmd after adding java_home? Can you show us exactly what error message you are now getting.