Run & debug cocos2dx 2.2.6 project on Android Studio

I have an old cocos2dx 2.2.6 project running on eclipse and I manage to move it to android studio by the following steps:

  1. Download or clone the following repository
    https://github.com/c0i/cocos2d-x226-android-studio

  2. Update CCGLProgram.cpp to run app on android studio emulator.

  1. After run and debug this sample application I’ve changed the package name to my app package name.

  2. Transfer my project to the new structure as following:

  • Copy and replace classes folder and resources folder with mine.

  • Copy and replace proj.android/jni to proj.androidstudio / [app name] / app / jni

  • Copy proj.android/res to proj.androidstudio / [app name] / app / res

  • Copy proj.android/…/Resources to proj.androidstudio / [app name] / app / assets

  • Copy proj.android/src/ [Top Directory] to proj.androidstudio / [app name] / app / src / [same folder name as src]

  • Then regenerate my android.mk file using AndroidMakeGenerator as shown here https://gist.github.com/daniaDlbani/6ebd0014583f870982c73ca15db579b3

  • build and add required dependencies one by one.

1 Like