Windows 7 coscos2d-x create-android-project.bat errors

I got this error for days and couldn’t figure it out. I am posting this in hopes that it will help others so they don’t waste time trying to find the solution.

  1. You run the create-android-project.bat file from your cocos2dx folder and get the following errors after choosing your target AVD:

ERROR: ———————————————————————————
A subdirectory or file c:already exists.
Error occurred while processing: c:A subdirectory or file Files already exists.
Error occurred while processing: Files.
Create Android project inside proj.android.
Error: Argument ’(86)2DXYourProjectName>.android is not recognized



Error!
Don’t run in cygwin. You should run corresponding bat.
Press any key to continue …
——————————————————————————————

FIRST of all, don’t put the NDK folder, the android-sdk folder, or the coscos2dx folder in a subdirectory that has ANY spaces in it! For example, I put all of the three above folders in my Program Files directory that has a SPACE in it, i.e. “c:/Program Files (86)/android/”. There is a space between “Files” and “(86)” and it is that space that causes the error in the batch file instruction. Batch files DO NOT LIKE SPACES. So instead, put the three folders in a folder without a SPACE: “c:android/”.

Doing that will solve the biggest problem with the batch file not working.

SECOND: Make sure you use explorer and grant permission to all three of the folders. Windows 7 restricts permission and the batch file won’t be able to create the new directory. Here are the instructions if you don’t know what I mean.

  1. Open explorer.
  2. Go to the directory that has all three files (NDK, android-sdk, coscos2dx).
  3. Right click on the folder NDK and choose Properties.
  4. Click on the Securities tab.
  5. Click on the EDIT button.
  6. Under “Groups or user names:” box, choose “CREATOR OWNER.” Below at the “Permissions for CREATOR OWNER” box, click on the box “Full Control” and click Apply.
  7. Click OK.
  8. You may have to do the same for all of the users in the “Groups or user name:” box if they don’t get full control.
  9. Click OK.
  10. Do the same for the android-sdk folder and the cocos2dx folder.
  • I searched the internet for days trying to figure out this simple problem and wasted lots of man hours. Hopefully this will help some of you to not waste that time that can be used more productively.

thank you so much! That worked =)