Cocos2d-x  2.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Run cocos2d-x successfully on the Android emulator

Problem and solution

For a few years the only option was to run the Android emulator by emulating the ARM instruction set on a x86 host machine. While this is still possible, it has two problems

So cocos2d-x does not run correctly.

The fix is to use virtualization with the x86 version of Android and enable GPU acceleration. With these options enabled, you can successfully use the emulator to develop with cocos2d-x!

How-to

  1. Download and create an Android emulator using the x86 system image
  2. Enable virtualization (with CPU's that support VT-X) on Windows/Linux/OSX
  3. Build cocos2d-x libraries for the x86 architecture too
  4. Run the emulator with the correct library path and options
  5. Success!

Download and create an Android emulator using the x86 system image

` <android-sdk>/tools/android `

Ensure that "Intel x86 Atom System Image" is selected, downloaded and installed for the Android version you are using.

Enable virtualization (with CPU's that support VT-X) on Windows/Linux/OSX

Please follow intel's instructions here on downloading/enabling virtualization for the Android emulator http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager/

Build cocos2d-x libraries for the x86 architecture too

In your app's Application.mk, add x86 to the supported ABI's by adding/editing this line

` APP_ABI := armeabi x86 `

Run the emulator with the correct library path and options

Make sure to

On OS X the command line looks like this

` LD_LIBRARY_PATH=~/bin/android-sdk/tools/lib ~/bin/android-sdk/tools/emulator-x86 -verbose -avd android17x86 -gpu on `