Problem when build Android project

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.

I think this will help: Attempting to run cpp-tests on Android, fails at ant

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 :frowning:

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. :frowning: Why???

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? :frowning:
Do you have resolution for this?

Thank for spent time for me :smiley:

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: :frowning:

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:

Do not start the python interpreter. Just open your console and type:

python cocos.py compile -s D:/hell/hell -p android

not work

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

error as #1 :frowning:

Then try the same in PowerShell, because it does escape ’ as well.

result same as in cmd :frowning:

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 :frowning:

I’m guessing you closed and restarted cmd after adding java_home? Can you show us exactly what error message you are now getting.