Notes for porting cocos2dx games from iOS to Android:
- create-android-project.sh
- eclipse > new project from existing code
- add NDK_ROOT variable in eclipse (build_native.sh need to define NDK_ROOT, otherwise will report "Please define NDK_ROOT")
NDK_ROOT "path.to/android-ndk-r8b"
- make eclipse able to compile c++
New > Others > Convert to c/c++ project
- setup build path
bash path.to/build_native.sh NDK_DEBUG=1 V=1
- add include path: C++ General > Path and symbols
$(COCOS2DX_HOME)/cocos2dx
$(COCOS2DX_HOME)/cocos2dx/include
$(NDKROOT)/platforms/android-9/arch-arm/usr/include
$(workspace_loc)/Classes
- add c++ classes
link from source
- Build all (this will build the c++ library)
- Run As (this will pack the apk using jni)
Note:
- create AVD > enable GPU emulation for OpenGL ES2.0 support (start from Android 4.03)
- upon test I'm still not able to run OpenGL ES2.0 in emulator, but deploy to real device will work