Cocos2d-x 2.1.4 How to setup proj.android and let eclipse compile it?

Cocos2d-x 2.1.4 How to setup proj.android and let eclipse compile it?
0.0 0

#1

In Mac, I usually use these steps to run an android project:

  1. Use create-android-project.bat making proj.android.
  2. Use console running the build_native.sh in the project to build libgame.so.
  3. Use eclipse to package the apk, and run it in my phone.

Use cocos2d-x 2.1.4 ,The step 2 and 3 can be both done in eclipse with CDT, so I tried, and sucessed in the sample projects(TestCpp and HelloCpp).

But when I want to compile a project created by the create-android-project.sh in this way, it cann’t be done.
I noticed the “.project” file in the sample projects is very complex, and there’s another “.cproject” file. I think they are the key.

Why sample is ok and create project is not ok?
My question is, how to generate them? Or how to Setup the my project to make it can be compiled by eclipse?


#2

Mine automatically compiles in eclipse.
Try setting this up in eclipse
Window > Preferences > C/C++ > Build > Environment
Add a PATH variable with a value of the directory of your cygwin\bin

Mine is C:

but i am using windows. and i have cygwin.
The setup should be somehow similar to Mac.


#3

Rick Lopez wrote:

Mine automatically compiles in eclipse.
Try setting this up in eclipse
Window > Preferences > C/C++ > Build > Environment
Add a PATH variable with a value of the directory of your cygwinin
>
Mine is C:cygwinin
>
but i am using windows. and i have cygwin.
The setup should be somehow similar to Mac.

Thanks for your reply!

But in Mac do not need cygwin.

Now the problem is import cocos2d-x 2.1.4/samples to eclipse is ok.(Can build c++ code in CDT Build Console automatically!)
But myself create project by create-android-project, then import to eclipse, it can not done.


#4

2.1.4 has a new way of creating projects…
Go to tools/project-creator/create_project.py

Well, you need to install python.
Check this out
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_create_a_multi-platform_project_in_one_command_line


#5

Rick Lopez wrote:

2.1.4 has a new way of creating projects…
Go to tools/project-creator/create_project.py
>
Well, you need to install python.
Check this out
http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_create_a_multi-platform_project_in_one_command_line

I tried your method provided successful, thank you very much!