Reprinted from: http://www.eoeandroid.com/thread-321983-1-1.html
(Source: EoE Mobile Developer Forum)
The construction method of this article is the newest and most correct method, a lot of friends reflect the building eclipse cross-compiling environment is very complex and headache, in fact, just online information is too fragmented, a step wrong and thousands of miles ah, not to say, if you read this article, congratulations, you saved at least 48 hours of life.
Are you ready? (Original address: http://www.418log.org/post-238.html)
This environment uses the current relatively stable tools to build, generally need things are: JDK Eclipse CDT ndk Cywin (This environment compilation does not need)
To make it easy for everyone to build quickly, I've integrated the Eclipse plugins needed for game development, and we recommend that you download the integrated version of Eclipse (address: http://www.418log.org/ post-204.html), the Eclipse Java EE 3.7.2 version, contains: adt22,tomcat6,jdk6,svn,uml,spring MVC CDT (c + +) plugin, is my own version, To meet the development of Android and web use.
The latest version of the NDK is already ready to compile the JNI code and can be configured for automatic compilation in Eclipse, without the need to install Cywin, (http://developer.android.com/tools/sdk/ndk/ index.html), I'm using the R9 version.
Android SDK, is the Android application development Library, to address (http://developer.android.com/sdk/index.html) download can.
Download Cocos2d-x: Address (http://www.cocos2d-x.org/download) I downloaded version 2.2.2.
A total list of required files, where (Cywin and Cocos2d-x-3.0beta are not required)
<ignore_js_op>
Here's how to run the hellocpp example to illustrate the steps of the environment setup:
(1) Import sample projects Hellocpp and LIBCOCOS2DX, it is important to note that you do not copy to the working directory, use the reference, or there will be many path problems.
(2) This time hellocpp will not compile through, to do some compile configuration.
(3) We modify/HELLOCPP/JNI/ANDROID.MK first
Add a red 2 sentence to the last side and before the $ (call IMPORT-MODULE,COCOS2DX):
$ (call Import-add-path, e:/android/cocos2d-x-2.2.2)
$ (call Import-add-path, e:/android/cocos2d-x-2.2.2/cocos2dx/platform/third_party/android/prebuilt)
$ (call IMPORT-MODULE,COCOS2DX)
(4) Modify/hellocpp/jni/application.mk
Add the environment variable (your cocos2d-x-2.2.2 's location) in the final side:
ndk_module_path:=e:/android/cocos2d-x-2.2.2; E:/android/cocos2d-x-2.2.2/cocos2dx/platform/third_party/android/prebuilt
(5)/hellocpp/assets directory to put some of the program to run the required pictures, the E:\android\cocos2d-x-2.2.2\samples\Cpp\HelloCpp\Resources\iphone directory under the image of the copy in.
(6) Let Hellocpp reference LIBCOCOS2DX library compile
<ignore_js_op>
(7) Configure the NDK installation path under Eclipse's window-preferences menu
<ignore_js_op>
(8) Modify the CDT builder's execution program for compiling so files, mainly for automatic compilation
<ignore_js_op>
<ignore_js_op>
(9) New environment variable Ndk_module_path and value
<ignore_js_op>
(10) After this step, connect your phone directly to run, and you will see so in the Libs directory.
<ignore_js_op>
Cocos2d-x build a development environment on eclipse