Today idle to nothing, I heard that the latest cocos2d-x New Version 3.0, so to learn.
General reference official Tutorial: http://www.cocos2d-x.org/wiki/How_to_Build_an_Android_Project_with_Eclipse
The environment configuration is as follows:
- System (Ubuntu 12.10 +, OS X 10.7 +, Windows 7 +) ps: My system is Windows 8
- Cocos2d-x v3.0 (https://github.com/cocos2d/cocos2d-x/) ps: It is recommended that you use c: \ cocos2d-x \
- JDK/sdks 1.6 +
- NDK r9d +
- Python 2.7.5 ps: This version is officially prompted. We do not recommend that you use 3.0 +.
- Eclipse with ADT Bundle
Python installation and configuration:
Download the python installation package to the python official website https://www.python.org, silly next step, register python environment variables after installation: my python installation path is C: \ python27. After the installation is complete, cmd enters dos, enter python press enter, enter python programming mode, and then input print "hello python! ", If printing is successful, the installation is successful!
Run build_native.py to generate the dependency library for Android:
The official documentation is as follows:
(Note this might not be the same as the previous section, but you can do it by navigating to the proj. android directory and run thebuild_native.py scripts .)
The general meaning is that when you create an empty cocos2d-x project first to compile its library, how to compile this library, can enter proj. run the build_native.py script in the android folder.
Cmd enters dos. Cd C: \ cocos2d-x-3.0 \ templates \ cpp-template-default \ proj. android execute the build_native.py script, you can start to compile, it looks like a few minutes.
As you can see, the compilation is successful and the. so library is generated!
The following describes the problems encountered during the compilation process:
1. The "Can't know cpuinfo, use default 1 cpu" error occurs in the build_native.py file. This indicates that you have not set the NDK environment variable.
Solution: correctly configure the environment variables of NDK_ROOT.
2. jni/Android. mk: Cannot find module with tag '2d 'in import path
Solution: To C: \ cocos2d-x-3.0 \ templates \ cpp-template-default \ proj. android \ jni open the Android. mk file, modify and add
Add $ (call import-add-path, C:/cocos2d-x-3.0)
Modify $ (call import-module, cocos/2d)
Modify $ (call import-module, cocos/audio/android)
Modify $ (call import-module, external/Box2D)
3, Android NDK: C:/cocos2d-x-3.0/cocos/2d/Android. mk: Cannot find module with tag 'freetype2/prebuilt/android' in import path
Solution: Go to C:/cocos2d-x-3.0/cocos/2d to open the Android. mk file, modify and add
Add $ (call import-add-path, C:/cocos2d-x-3.0)
Modify $ (call import-module, external/freetype2/prebuilt/android)
Modify $ (call import-module, external/chipmunk)
Modify $ (call import-module, cocos/2d/platform/android)
4. Android NDK: C:/cocos2d-x-3.0/cocos/2d/platform/android/Android. mk: Cannot find module with tag 'jpeg/prebuilt/android' in import path
Solution: To C:/cocos2d-x-3.0/cocos/2d/platform/android open the Android. mk file, add
$ (Call import-add-path, C:/cocos2d-x-3.0/external)
Import a project, generate and run a xcocos2d-x Project
After completing the appeal step, open eclipse and import the compiled C: \ cocos2d-x-3.0 \ templates \ cpp-template-default \ proj. android.
And then import C: \ cocos2d-x-3.0 \ cocos \ 2d \ platform \ android its dependent Lib.
See that your xcoco2d-x v3.0 project has been done! Next, you can start to develop your first mobile game.