Doc:2.6/Manual/Game Engine/Android/Building Blender for Android

提供: wiki
移動先: 案内検索

Building Blender for Android


Because Android uses Java primarily, Blender building is much harder and requires multiple steps.

  • Build Android App
  • Build Blender
    • This will use Android App to run makesdna and makesrna and copy results back
  • Two options
    • Push libs and executable with a script to Android App
    • Create and recompile Android App so it can be easily used for distribution
      • Sign for release


Currently Android can be build on linux and probably on Mac (isn't tested). There won't be Windows support in near future because we should use gcc-like compile, and it will be troublesome to support Windows environment (paths, scripts). Also, you have to have real Android 2.2 or higher device, in order to compile and test Blender as emulator doesn't support OpenGL ES 2.0. Beware that Android port is a work in progress: a. There is no graphic output yet. b. Build system might be broken, but I will try to make sure that it is compilable every Friday

Installing Android SDK and JDK

  • Use this to install Eclipse (or JDK 6, Apache Ant) and then Android SDK
  • Everything except SDK can be downloaded through distro's repository
  • You need :"apt-get install ia32-libs" if linux is x64
  • Add following paths to PATH
<<Path to Android SDK>>/android-sdk-linux/tools/
<<Path to Android SDK>>/android-sdk-linux/platform-tools/
  • Run "android" command from <<Path to Android SDK>>/android-sdk-linux/tools/
    • Install SDK 13
    • SDK 10
  • To test if it is succesfully set up, run
adb devices

Installing Android NDK

Install NDK (I recommend r7b or r8 version, because it is what I use and with which all libs are compiled and r8a fails on some devices)

Also add it to PATH

<<Path to Android NDK>>/android-ndk-r7b
  • Now create standalong toolchain
    • Remember its path
<<Path to Android NDK>>/android-ndk-r7b/build/tools/ --platform=android-9 --install-dir=/__absolute_path__/androidtc
  • For lib compilations I used android-9

Making First Android App

Go to


Connect your device. And then in terminal run


This script should compile small C and Java source. Created app will be send to device.

Now, restart the device to avoid problems in next step.

Compiling Blender

Create a folder on the same level as soc-2012-swiss_cheese and lib. For example "abuild"

mkdir abuild
cd abuild

Generate Cmake file in build folder

 cmake -DCMAKE_TOOLCHAIN_FILE=../soc-2012-swiss_cheese/build_files/cmake/config/blender_android.cmake  ../soc-2012-swiss_cheese -DTOOLCHAIN_PATH=/<<your_toolchain_path>>

now run make


Now you have inside abuild/lib

Deploying to Device

Method I

This is method is used for deployment

Create for Android App

It must contain:

  • python
    • include
    • lib
    • scripts

Here is template without Add freshly compiled and place as source/app/assets/

Caution,, etc must me in root dir inside

Recompile Android App

./ is unzipped by Android App during first start up to insternal directory (/data/data/ If you have rooted device, you can

adb shell
cd /data/data/

To see internal files

Method II

This is method for fast updating some files. Internal app file structure corresponds to You can directly "adb push" files from desktop to /data/data/ if you device is root. Or you can use

adb push desktop.file /sdcard/temp.file
adb shell am start -n --es from /sdcard/temp.file  --es to device.file


If something failed, irc me. Probably I already had that problem and forgot to mention here. ndk-gdb is very poor because it goes through all java hoops and don't have a source and good backtrace. The build system is not optimized. You can improve performance by adding C flags inside cmake:

-march=armv7-a -mfloat-abi=softfp -mthumb