Easy Guide to setup the cocos2d-x for android in Windows

Hi Nguyen, don’t you had the second problem I mentioned? I am stuck in that problem. :confused:

I solve the problem. Its that it’s not possible to copy the game folder to another place, like is implicit in the ninth step. It shall be kept in the original place that create script place it.

Hi,there.

:slight_smile: Thank you for the tutorial.
And at the Cygwin building step. I have a trouble and sincerely need your help.
I wrote a topic here.

Thank you ! :slight_smile:

Thank you so much for this thread. I just managed to get the hellocpp project running on my android from eclipse.

There is also one more problem that’s not mentioned in this thread and it’s to do with the ‘Function/Method xyz not resolved’ error given by the code analysis. Solution here:
http://stackoverflow.com/questions/10755547/how-do-i-fix-eclipse-cdt-error-function-isdigit-could-not-be-resolved-with-a
Basically you go into project properties and downgrade the error to a warning.

As cygwin will not longer be used (http://www.cocos2d-x.org/issues/2834), I think the setup will no longer appropriate in latest version

For vs-android, our issues are complicated because I included boost library in solution. Also there are macro definition such as “WIN32” required to remove. I will try to create a small build from new cocos2d project first.:slight_smile:

Hello.

First of all thanks for guide.

Also I must add, if anyone encounters with an error on CCFileUtilsAndroid that finishes within “android-ndk-r8-crystax-1/build/core/build-binary.mk:320: reci pe for target ‘obj/local/armeabi/objs/cocos2dx_static/platform/android/CCFileUti lsAndroid.o’ failed
make: * [obj/local/armeabi/objs/cocos2dx_static/platform/android/CCFileUtilsAn droid.o] Error 1
make: Leaving directory ‘/cygdrive/d/AndDev/cocos2d-x-2.2/projects/HelloAndroid/ proj.android’”

Go to:
cocos2d-x-2.2\cocos2dx\platform\android

and include fstream in
CCFileUtilsAndroid.cpp

like

#include

I am new to cocos2d-x.I am setting Cocos2d-x for windows. When I am opening the hello.cpp project in Eclipse-ADT it is giving me the error (program “make” is not found in path).

READ ME FIRST
These guides written in this forum don’t make any sense and I don’t even know if they work.
If you’d like to read an easy to follow guide that works.

Install MinGW from the guide below. This will take care of compiling the C/C++ code (with bash) for you with Gnu. Remember that Windows requires you to log out and back in after you make changes to the Path in environment variables.
http://www.multigesture.net/articles/how-to-install-mingw-msys-and-eclipse-on-windows/

Download Eclipse if you didn’t already.
In Eclipse update the SDK, Window->SDK Manager
NOTE You should use a real Android device plugged in via USB because Cocos2dx requires OpenGL which doesn’t run easily via the emulator. Make sure you check “Use Host GPU” if you do use an emulator. For me, the biggest hurdle in using Windows to do Android development with Cocos2d is to get Windows to recognize my Android device on USB properly.

Download Cocos2d-x-2.2.2, example path, “c:/development/projects/cocos2d-x-2.2.2”
Download Android NDK, example path, “c:/development/lib/android/ndk”

Open Eclipse

Eclipse preferences (for all Cocos2d related projects)
Eclipse->Preferences->General->Workspace->Linked Resources->NEW
-set “COCOS2DX” to the path we chose above “c:/development/projects/cocos2d-x-2.2.2”
Eclipse->Preferences->C/C++ > Build > Environment > ADD
-set “NDK_ROOT” to the path we chose above"c:/development/lib/android/ndk"

Create a workspace for your Cocos2d Project.
Choose new “Android Project from Existing Code” (I had to select “other” to see this option)
“c:/development/projects/cocos2d-x-2.2.2/cocos2dx/platform/android/java”
You’ll need to include this project to get cocos2d-x.

Now you may create your Cocos2dx project, or add a sample project:
Choose new “Android Project from Existing Code”
“C:\development\projects\cocos2d-x-2.2.2\samples\Javascript\MoonWarriors\proj.android”

Note: at this point you should have 2 projects in your Workspace. Click on the second one, ex: MoonWarriors and then press Run (after you plug in your device or setup an emulator).

Hjcc fix error for me, pls :frowning:

Tran@AmateurTran ~
$ cd $COCOS2DX_ROOT

Tran@AmateurTran /cygdrive/c/Cocos2D-X/cocos2d-x-2.2.2
$ python
-bash: python: command not found

Tran@AmateurTran /cygdrive/c/Cocos2D-X/cocos2d-x-2.2.2
$ cd tools/project-creator

Tran@AmateurTran /cygdrive/c/Cocos2D-X/cocos2d-x-2.2.2/tools/project-creator
$ python ./create_project.py -project TestGame -package com.MyCompany.TestGame -language cpp
-bash: python: command not found

Tran@AmateurTran /cygdrive/c/Cocos2D-X/cocos2d-x-2.2.2/tools/project-creator
$

OS: window 8 64 bit

Anyone can help me, i cannot find gcc-g**, gcc4-core, gcc4-g**, from cgywin installation.
Please help.

Thank, save my day