It is not complicated to create the Android project of Cocos2d-X under Windows, the key is to change several environment variables.
1. Go to the Cocos2d-X home directory to modify create-android-project.bat"
Everyone knows you should click "create-android-project.bat" to generate a new project, but you should make some changes according to your environment before running the build wizard.
To adapt to my configuration environment, I made some changes in the create-android-project.bat.
Set_CYGBIN = D: \ cygwin \ bin
This is the path of Cygwin bin.
Set_ANDROIDTOOLS = D: \ android-sdk-windows \ tools
This is the path of android sdk tools.
Set_NDKROOT = D: \ android \ android-ndk-r8e
This is the root directory of ndk.
Now you can run create-android-project.bat to create an android project:
Go to the root directory of the cocos2d-x, double-click the create-android-project.bat, and enter the name of the project and target id. This is simple.
2. Modify "build_native.sh" of the new repair project"
Copy your project to your favorite location, and modify a directory item in "build_native.sh" before compiling C ++ code.
3. Run "build_native.sh" in cygwin to compile C ++ code
4. Move the project to eclipse
Run your eclipse and click File> New> Project> Android Project to import the Project.
Of course, you can also import the project first before proceeding to steps 2 and 3!
5. Compile and run java code
Right-click the Project and select "Build Project"