In learning coco2d-x found that, or in xcode write code and debugging is more convenient, but after writing how to transplant to Android, generate APK? It's easy, just a few steps.
1. Complete the game project in xcode.
2. Generate the android Project (to use the command line, the coco2d-x official website has the steps to generate the android project ).
3. Copy all the resource files used by the IOS project to the resource folder of the android project, and copy all the code files to the classes folder.
4. Modify Android. mk in the jni folder of the android project.
Android. mk:
For example, you should have only main. cpp \
.../../Classes/appdelegate. cpp \
.../../Classes/helloworldscene. cpp
Add new. cpp
Main. cpp \
.../../Classes/appdelegate. cpp \
../Classes/helloworldscene. cpp \
../Classes/xxx1.cpp \
../Classes/xxx2.cpp \
../Classes/xxx3.cpp
5. Use the command line to call build_native.sh (my Mac, so it is SH) in the android project for compilation.
6. After compilation is complete, import and modify the project in eclipse and compile and run the project. The android game APK is generated successfully.
Note: If the underlying C ++ code is modified, you only need to recompile the underlying library and compile and run it in eclipse.