1. Go to the cocs2d-x directory and open the create-android-project.bat with a text editor
Set _ cygbin = to the absolute path of cycgwin \ bin installation.
Set _ androidtools to the absolute path of Android SDK tools
Set _ ndkroot to the absolute path of Android ndk.
Modified and saved
Double-click the create-android-project.bat to start the project creation wizard
First, enter the package name (we recommend that you follow the naming rules of Android), such as com. Android. Test.
Enter the project name (do not enter the name of the existing folder. If the name is the same, it will be overwritten), such as testandroid
2. ndk source code compilation
A, enter the cocos2d-x \ testandroid \ Android directory, right-click to open build_native.sh, You need to modify android_ndk_root for your specific ndk path
Android_ndk_root =/cygdrive/e/android-ndk-r5
Cocos2dx_root =/cygdrive/D/work7/cocos2d-x
Game_root = $ cocos2dx_root/testandroid
Game_android_root = $ game_root/android
Resource_root = $ game_root/Resource
Versions 2.0.3 should be:
Add the path to your ndk, for example:
Ndk_root = "/cygdrive/E // Android/android-ndk-r8b /"
Modify the following path, for example:
Cocos2dx_root = "/cygdrive/e/Android/cocos2d-2.0-x-2.0.3 /"
App_root = "/cygdrive/e/Android/cocos2d-2.0-x-2.0.3/cocos2dx2 /"
App_android_root = "/cygdrive/e/Android/cocos2d-2.0-x-2.0.3/cocos2dx2/proj. Android /"
B. Open cygwin, enter the testandroid/Android directory, and enter./build_native.sh to start compiling.
In version 2.0.3, it should be the proj. Android directory.
C. After the compilation is successful, the so file (libgame. So) will be generated directly under the directory testandroid \ Android \ libs \ armeabi)
3. Run the new project
Open eclipse, select File-> New-> Android project, and then select Create project from existing source
Select the \ cocos2d-x \ testandroid \ Android directory. The project is successfully created from the file (the corresponding APK package will be generated in the \ testandroid \ Android \ bin directory)
Run the project, right-click the project, and choose run as> Android Application
In version 2.0.3, add the org. cocos2dx. Lib project to eclipse. The path is as follows:
E: \ Android \ cocos2d-2.0-x-2.0.3 \ cocos2dx \ platform \ Android \ Java \