Update: 2015-02-18 – ndk version

You can now compile OGRE3D using NDK and the OGRE branch version 1.9. Ive followed the instruction in OGRE wiki for compiling for Android but got stuck several times in several areas and almost just give up. Im new to Android specially using the NDK and all of this just overwhelmed me. So this is a step by step guide Ive decided to make on how to compile OGRE for people that are like me, new to Android.

Requirements:

Install

  • Extract the Android SDK.
  • Extract the Android NDK on the same folder of the SDK so that it would now look like this
    -Android Tools
    –SDK
    –Eclipse
    –NDK
  • Extract OGRE source on the same folder as the NDK
  • Extract OGRE dependencies on the OGRE source folder. It should look like this
    -OGRE source
    –AndroidDependencies
    —include
    —lib
  • Install CMake and MinGW

Setup Environment Variables

  • Create a “ANDROID_SDK” in your env path and set it to the Android SDK path
  • Add “%ANDROID_SDK%/tools” and “%ANDROID_SDK%/platform-tools” to your PATH variable
  • Create a “ANDROID_NDK” in your env path and set it to the Android NDK path
  • Add “%ANDROID_NDK%” to your PATH variable
  • Add MinGW “bin” folder path to your PATH variable

Creating the MinGW Makefile Using CMake And Compilation

  1. Open CMake(cmake-gui)
  2. Make sure CMake “Grouped” and “Advanced” checkbox under build path are checked
  3. Add OGRE source and set the build path to where you want to build OGRE. Preferably on the same folder level as the source and name it “ogre_android”
  4. Click “Configure”
  5. In the drop down box select “MinGW Makefiles” and select “Specify toolchain file for cross-compiling” then click “Next” button
  6. Set the toolchain to “android.toolchain.cmake” this can be found in the OGRE source folder under “CMake/toolchain”
  7. It will auto configure and will most likely show some errors
  8. Under “ANDROID” make sure that “ANDROID_NATIVE_API_LEVEL” is set to 9
  9. Under “CMAKE” make sure that “CMAKE_MAKE_PROGRAM” is set to NDK “make”. This can be found in NDK folder under “prebuilt/windows/bin”
  10. Under “OGRE” make sure that “OGRE_DEPENDENCIES_DIR” is set to the extracted OGRE Android Dependencies folder
  11. Click “Configure” again it should now configure properly without errors then click “Generate”
  12. Now open “cmd” and “cd” to the CMake build path then enter “mingw32-make”

Notes:

  • As of this writing an error occured while building OgreJNI.
    This is because this has dependencies that is not yet compiled since the ordering of the compilation was wrong. You can ignore this and just run the mingw32-make again.
  • I had to export a signed apk of the SampleBrowser in Eclipse to be able to install it on my phone since the generated apk after building OGRE was having a “Parsing Error”.