Many of you have been using Cocos2dx for Android Games on your Windows OS.I too have been working on Windows OS but the problem is when you build your android project in eclipse then it uses Cygwin to execute the build commands. I have experienced this process is very slow. Specially when we start build then it stars copying all content of “Resources” directory to “proj.android/assets” directory. And because this runs on emulated environment therefore it takes significantly more time. Also I have faced many permission denied issues while building my project using Cygwin environment in eclipse.
Therefore I have tried to simplified this process which lets you to build and run your Android project in eclipse without Cygwin.
Benefits of this method :
No need of installing Cygwin on your Windows OS.
No anymore “Permission Denied” issues.
Save at-least at least 1-2 minute on every build.
How to use this in your project :
Add NDK path in Path environment variable.
Add NDK_ROOT in your environment variables.
Add NDK_MODULE_PATH in your environment variables.
Create a builder in eclipse to copy resources to assets.
Set C/C++ Builder settings in eclipse
You can follow a detailed tutorial in the below given link:
I can confirm, this is way better.
>
I created a script called ‘build.bat’ which I run outside of Eclipse
>
[…]
>
I put build.bat inside of proj.android, run it and everything is awesome.
Sure it’s better but here what I have tried is, if you are working on Eclipse then in one click you can build and run your project on to device. In your case if you execute “ndk-build.cmd -C” command externally from batch file then it will work perfectly and build your C*+ source and libraries. But again you need to build java part of project from eclipse and if you dont provide any argument in Project Properties C/C*+ Builder build command then it won’t let you to run your project. In my case if you need to :
Debug your C/C*+ code.
Deploy apk directly onto device.
Then you can set “ndk-build.cmd” in your Eclipse project C*+ Build Command. More-ever you can also debug your C++ code using Buld Command “ndk-build.cmd NDK_DEBUG=1”
I know this isn’t directly related, but I use Mingw32 instead of Cygwin under Windows, as I think it is faster and easier to install, and small in size.
Also, it is nice to have some linux commands under windows, such as grep.
Using Mingw32 is very easy (I describe here): http://www.cocos2d-x.org/forums/6/topics/26741
I know this isn’t directly related, but I use Mingw32 instead of Cygwin under Windows, as I think it is faster and easier to install, and small in size.
Also, it is nice to have some linux commands under windows, such as grep.
Using Mingw32 is very easy (I describe here): http://www.cocos2d-x.org/forums/6/topics/26741
For the latest NDK you don’t need anything (Cygwin/Mingw32) etc for building projects on Windows.
This is a pretty good method. Another way is to use the build_native.cmd script that is in cocos2d-x 3.0: Go into Eclipse and set Properties -> C/C++ Build -> Build command to ${ProjDirPath}\build_native.cmd.
Also, to get a parallel build that uses all your CPU cores, enable C/C++ Build -> Behavior tab -> Enable parallel build -> Use optimal jobs, then edit build_native.cmd to pass * to ndk-build.cmd (I have opened “this feature request”:http://www.cocos2d-x.org/issues/2878 regarding *).
Could you help me to resolve the problem when include “proj.android” into Eclipse. I saw an error in file Android.mk, “$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx)”
That’s the issue I cannot build the android project. Thank for your help