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

Hi Nguyen,

I did check this again and did not see any issues on my PC. I googled as well on this error and I found that it might be related to the issues with the NDK Build. So, I think your code might not be properly build for android using NDK. I suggest you go through some alternative way to build your native code using NDK. Cory Trese suggested a good way to go with this.

Nguyen Truong Minh wrote:

@Sriram Kumar Bikkina : Thank you for the reply! I did it step by step, until Step 11, I typed “sh build_native.sh”. And I also downloaded the latest version of “ADT Bundle”. In Step 12, I imported the project by navigating till proj.android folder. Please look at this picture : [[http://i609.photobucket.com/albums/tt173/minhnt_bkhn/Untitled_zpsf5c3f9a0.jpg]] . Please tell me when you find any mistakes. Thank you !

Sriram Kumar Bikkina wrote:

That is the problem with VS Android. No where they mentioned about how to create a new project. When I googled, I found that there is no way to create a new project with vs-adnroid. Only thing you can do is to edit one of the sample projects and start building your project.
winipcfg exe wrote:
> Sriram Kumar Bikkina wrote:
> > I am using VS 2010 Ultimate and it worked for me.
> >
> > Did you do this step?
> > For Vista or Windows 7 you will need to right click ‘install_vs20XX.cmd’, and choose to ’Run as Administrator".
> >
> > Are you getting any error?
>
> Problem is that I am able to compile sample vs-android project while I do not know how to setup for cocos2d-x projects:)

I am trying to convert the win32 solution to Android. After updating definitions, configurations and seems like everything is still like a mess :stuck_out_tongue:

Is it possible to give us some tips on how to setup and compile a cocos2d-x sample? Thanks.

Jair Humberto da Silva Filho wrote:

Hello, How can I find the gcc4-core and gcc4-g++ cygwin packages? I found the others except this two. :confused:

Configuring stuff these days is such a nightmare and all the missing pieces to find, conflicts and where do I have to jump through what hoops to get this piece of junk to build…

What would be heroic, if someone would build a virtual machine, (VMWare, Virtual PC, Virtual Box, whatever) that had an O/S (any I don’t care but Linux would be legal) and a pre-installed Cocos2dx development environment for Android development.

That would be would get kudos by the bucketful from me.

I’ve been messing about with SailfishOS SDK, Tizen SDK, and other useless pieces of crap. I am thoroughly sick and tired of installing things that don’t work, require conflicting plugins or are just thoroughly a sick joke. There is no Windows8 installer and the Windows7 installer won’t install on Windows8, the OS-X installer won’t install on the current version of OS-X because it seems to rely on an OS-X version two whole point releases ago. Back to Cocos2dx, Windows Phone8 won’t even build release versions out of the box, how hard can it be to change the freaking drop down from Debug to Release before packaging a build. http://www.cocos2d-x.org/forums/6/topics/36974

I am just so over installing stuff that does not work out of the box, without spending days trying to resolve conflicts of some kind or another. I just want to creating not spend my time tweaking utterly worthless useless rubbish. Instead we have this just follow this easy 13 step plan, maybe just maybe you won’t stuff one of them up, maybe just maybe there won’t be some freaking missing dependancy or some useless conflict with something else.

I will probably never ever buy a SailfishOS or Tizen phone just because the time I’ve wasted trying to get their gao shi development environments to work.

I’ve never ever been able to get a dev environment for Cocos2dx for Android to work properly but I’ve been able to create 12 apps in the apps store with iOS (including Cocos2d) because shit just works out of the box in xcode.

Don’t waste my time trying to config stuff or jump through hoops to get a feaking release build to work.

R.

Hello Regan Russell, I understand you completely. Good people try to help, like our friend Sriram Kumar Bikkina. But unfortunately, what you said is what happens.

Regan, I understand your frustration on setting up cocos2d-x. I myself worked hard on a trail and error basis for almost a week and then succeeded in installing cocos2d-x on a windows machine. I can say that this time was well wasted. I figured out there might be fellas’ like me and wanted to help them to easily setup cocos2d-x. That’s the reason I wrote this guide.

Regan Russell wrote:

Jair Humberto da Silva Filho wrote:
> Hello, How can I find the gcc4-core and gcc4-g++ cygwin packages? I found the others except this two. :confused:
>
Configuring stuff these days is such a nightmare and all the missing pieces to find, conflicts and where do I have to jump through what hoops to get this piece of junk to build…
>
What would be heroic, if someone would build a virtual machine, (VMWare, Virtual PC, Virtual Box, whatever) that had an O/S (any I don’t care but Linux would be legal) and a pre-installed Cocos2dx development environment for Android development.
>
That would be would get kudos by the bucketful from me.
>
I’ve been messing about with SailfishOS SDK, Tizen SDK, and other useless pieces of crap. I am thoroughly sick and tired of installing things that don’t work, require conflicting plugins or are just thoroughly a sick joke. There is no Windows8 installer and the Windows7 installer won’t install on Windows8, the OS-X installer won’t install on the current version of OS-X because it seems to rely on an OS-X version two whole point releases ago. Back to Cocos2dx, Windows Phone8 won’t even build release versions out of the box, how hard can it be to change the freaking drop down from Debug to Release before packaging a build. http://www.cocos2d-x.org/forums/6/topics/36974
>
I am just so over installing stuff that does not work out of the box, without spending days trying to resolve conflicts of some kind or another. I just want to creating not spend my time tweaking utterly worthless useless rubbish. Instead we have this just follow this easy 13 step plan, maybe just maybe you won’t stuff one of them up, maybe just maybe there won’t be some freaking missing dependancy or some useless conflict with something else.
>
I will probably never ever buy a SailfishOS or Tizen phone just because the time I’ve wasted trying to get their gao shi development environments to work.
>
I’ve never ever been able to get a dev environment for Cocos2dx for Android to work properly but I’ve been able to create 12 apps in the apps store with iOS (including Cocos2d) because shit just works out of the box in xcode.
>
Don’t waste my time trying to config stuff or jump through hoops to get a feaking release build to work.
>
R.

I’ve been a paid coder since 1988, so I am a grumpy old fart having a major melt down.

However, here is my experiences with Cocos2d:
iOS
—
Install xcode, cocos2d, churn out a dozen apps about half are cocos2d apps. Everything just works. I configure nothing, nada, nil, zilch, zip.

Windows Phone
—————
Install Visual Studio, install a version of cocos2d much older than the current one. Build a cocos2d app. Jump through hoops trying to get the release build to work…


Write up something on the wiki about working with the older version for WP8
http://www.cocos2d-x.org/wiki/Windows_Phone_8_Environment_Setup?project_id=cocos2d-x
Audio works in debug, release build - no audio, post on these forums, no help.
Sit down with a Microsoft support Engineer in the local Microsoft building, he couldn’t work it out either. Release a crappy game with no audio - http://www.cocos2d-x.org/forums/21/topics/31696

Download the current version of cocos2d for Windows Phone, build debug, test, works okay, good, now switch to release on the drop down in VS, won’t even build… http://www.cocos2d-x.org/forums/6/topics/36974 I’ve done nothing but change a drop down and within 10 minutes of downloading the latest version I’m giving up on it.

Android
——-
Attempt to mess about with the Android SDK, NDK, and whatever on 3 different platforms (OS-X, Linux, Windows), get annoyed enough to wander off and kick something, each time. Not even to the point of working with Cocos2d.

Sriram Kumar Bikkina wrote:

Regan, I understand your frustration on setting up cocos2d-x. I myself worked hard on a trail and error basis for almost a week and then succeeded in installing cocos2d-x on a windows machine.
So thanks for providing this guide. Damn shame that stuff doesn’t just work and you have to waste a week trying to figure stuff out. Personally, I hate guessing games.

Now, you darn kids git orf my lawn :wink: :wink:

R.

The python package should be included among the cygwin packages, and gcc4-core and gcc4-g*+ should be removed, once gcc-core and gcc-g*+ are mentioned already.

Well, finally I arrived at the twelfth step, but unfortunatelly, the same error Nguyen got, happened to me :confused:

however, this tutorial is great! Congratulations, you was a real warrior discovering everything.

I found the solution for the problem above in http://stackoverflow.com/questions/18162226/program-bash-is-not-found-in-path

But, now, I got the following problem
“* Android NDK: Aborting. .Stop.”

@Jair Humberto da Silva: I also did follow the guide in that link, fortunately my problem is solved :D.

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