create-android-project.bat not working

create-android-project.bat not working
0.0 0



I’ve download cocos2d-2.1rc0-x-2.1.3 and edited create-android-project.bat to set some variables:

set CYGBIN=C:setANDROIDTOOLS=C:~~bundle-windows-x86-20130219\sdk\tools
set _NDKROOT=C:~~ndk-r8e

When I run the batch I get this output:

Please enter your package path. For example: org.cocos2dx.example:com.test
Please enter your project name:Test
"Now cocos2d-x suppurts Android 2.1-update1, 2.2, 2.3 & 3.0"
"Other versions have not tested."
Available Android targets:
id: 1 or "android-17"
     Name: Android 4.2.2
     Type: Platform
     API level: 17
     Revision: 2
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, W
XGA720, WXGA800, WXGA800-7in
     ABIs : armeabi-v7a
Please input target id:1
Create android project
Create Android project inside
Created project directory: X:\cocos2d-2.1rc0-x-2.1.3\Test\
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\src\com\test
Added file X:\cocos2d-2.1rc0-x-2.1.3\Test\\src\com\test\
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\res
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\bin
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\libs
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\values
Added file X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\values\strings.xml
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\layout
Added file X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\layout\main.xml
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\drawable-xhdpi

Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\drawable-hdpi
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\drawable-mdpi
Created directory X:\cocos2d-2.1rc0-x-2.1.3\Test\\res\drawable-ldpi
Added file X:\cocos2d-2.1rc0-x-2.1.3\Test\\AndroidManifest.xml
Added file X:\cocos2d-2.1rc0-x-2.1.3\Test\\build.xml
Added file X:\cocos2d-2.1rc0-x-2.1.3\Test\\proguard-project.txt
Resolved location of library project to: X:\cocos2d-2.1rc0-x-2.1.3\cocos2dx\plat
Updated file X:\cocos2d-2.1rc0-x-2.1.3\Test\\proguard-project.txt
/cygdrive/x/cocos2d-2.1rc0-x-2.1.3/template/android/ line 32: /cygdriv
e/x/cocos2d-2.1rc0-x-2.1.3/Test/ Permission denied
sed: can't read /cygdrive/x/cocos2d-2.1rc0-x-2.1.3/Test/
os2dx/hellocpp/ Permission denied
rm: cannot remove `/cygdrive/x/cocos2d-2.1rc0-x-2.1.3/Test/
cocos2dx/hellocpp': Permission denied
Press any key to continue . . .


Some folders and files are getting strange permissions, which make them un-editable and undeletable.

Is this a known issue?




i have no idea what happened to you,but i suggest you that right click “create-android-project.bat” and run it as administrator.hope it works.:smiley:


lu bai wrote:

i have no idea what happened to you,but i suggest you that right click “create-android-project.bat” and run it as administrator.hope it works.:smiley:

It works, thanks. It would never cross my mind that the batch needs administrator privileges.


Spoke too soon… It seems the project is created, but the permissions are wrong. I have to edit them to add my user with full control to the project directory and its children.

Even then, when the project is imported into Eclipse it has some errors:

Description Resource    Path    Location    Type
The import org.cocos2dx.lib cannot be resolved   /Test/src/com/leiradella/test   line 26 Java Problem
Cocos2dxActivity cannot be resolved to a type   /Test/src/com/leiradella/test   line 33 Java Problem
Cocos2dxActivity cannot be resolved to a type   /Test/src/com/leiradella/test   line 30 Java Problem
error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/icon').    AndroidManifest.xml /Test   line 10 Android AAPT Problem

I took a look at the\src\org\cocos2dx folder and it’s empty. I was expecting to find a lib subfolder and in it. I then copied everything under cocos2dx\platform\android\java\src\org and, after fixing the icon error, I was able to build and run the project.

However, the application fails to run in the emulator, and LogCat is showing some link errors which lead me to believe that the project is still broken…

Note: I get an error when I try to run create-android-project.bat as Administrator:

Error!!! You should run it under cocos2dx root

What I did was running cmd.exe as Administrator, navigating to cocos2d-x root directory and then executing the batch file.




Is there any documentation on how I can, after setting up an Android project in Eclipse, manually copy the necessary files to build a cocos2d-x application?


Never mind. I really should stop multitasking and follow the documentation. After executing the project worked.