METS BLOG

METS BLOG

Cocos2D-X develop for Android on Virtual Box

Android can be installed as a virtual machine, but cocos2d-x needs OpenGL support.
This is where AndroidVM comes in.You can download it at AndroidVM.For this setup I used a linux environment.
Setting it on other platforms would be almost the same.

Required Software:

  • VirtualBox – I guess you already know what this one is since you are here.
  • AndroidVM – An Android virtual machine
  • AndroidVMPlayer – This is the emulator like device we will be using
  • Android SDK – we will use SDK platform-tools(adb) for connecting to the Virtual machine.
  • Android NDK – compile your cocos2dx project

Setup

  1. Download and install VirtualBox.
  2. Download AndroidVM (Choose one according to your OS)
  3. Download AndroidVMPlayer and extract it somewhere you can easily find
  4. Import AndroidVM to VirtualBox (double click the downloaded VM or import through menu)
  5. You can close the virtualbox now
  6. In your PC now, open a terminal and cd to the folder you extracted AndroidVMPlayer and execute ./AndroidVMPlayer.sh
  7. It will setup the virtual machine and hardware acceleration for you, when the virtual device starts you will see an IP on the window title, this IP will be used to connect the adb with AndroidVM

Connecting the adb

  1. Goto your android-sdk/platform-tools
  2. Execute ./adb connect IP (of the virtual machine, the one you noted ex:192.168.56.101)
  3. If connected the next time you try launching your Android app from Eclipse you can choose AndroidVM as a device.

Usage and Notes:

  • You can start AndroidVM through AndroidVMPlayer.sh so no need to launch virtual box , but still need to connect with adb
  • Using api 2.3 – be sure to add APP_ABI := x86 to your Application.mk or you will get UnsatisfiedLinkError
  • Using api 4.0 – APP_ABI := armeabi
  • Using api 4.2 – APP_ABI := armeabi-v7a
  • AndroidVMPlayer may need 1-2 seconds to refresh when switched to another window and back (same as the emulator)

Enjoy fast openGL supported virtual device 🙂


3 responses to “Cocos2D-X develop for Android on Virtual Box”

  1. Android says:

    Great and nice blog. It’s also very interesting. We also have a website about Engineerbabu.
    Please visit our website: http://engineerbabu.com/

    • metin says:

      thank you, I’ll visit your site later and by the way this post is a little outdated because the Android VM has been updated if you or anyone is interested I’m going to update it.

  2. Marjorie says:

    I don’t even understand how I stopped up right here, but
    I believed this put up was once good. I don’t recognise who
    you might be however definitely you are going to a famous blogger should you are not already.
    Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *