Skip to content

TiGL Viewer Android

Tobias Stollenwerk edited this page Mar 18, 2015 · 7 revisions

Building the TiGLViewer Android App with Linux

In this page we want to give a step by step tutorial, how to build the TiGLViewer Android App from Linux. You can also build the App from Windows with slightly modified instructions.

Before you start development, you need to:

  1. Download the Java JDK from http://www.oracle.com/technetwork/java/javase/downloads . Please download the binary 'tar.gz' version instead of an rpm.
  2. Download the Android SDK from http://developer.android.com/sdk . It's best to download the complete ADT bundle since it already includes an android target platform, an emulator and much more...
  3. Download the Android NDK from http://developer.android.com/tools/sdk/ndk
  4. Install git and cmake with your linux package manager
  5. The build of the TiGLViewer App requires a number of third party libraries to compile, like OpenSceneGraph, OpenCASCADE and others. Fortunately, you don't have to compile these for yourself as we provide prebuild ARM and x86 binaries for android. Please download them from http://sourceforge.net/projects/tigl/files/DevTools/3rdparty-android.tar.gz/download .

Details

From now on, we assume, that each downloaded file is located under ~/Downloads/. All commands will be executed from a shell terminal.

  • Open a shell and create a development directory "Devel" and go into the directory.
mkdir ~/Devel
cd ~/Devel
  • Extract the Java JDK, the Android SDK and NDK. Please note, that the downloaded files might be named differently.
tar -zxvf ~/Downloads/jdk-7u45-linux-i586.tar.gz
unzip ~/Downloads/adt-bundle-linux-x86-20131030.zip
tar -jxvf ~/Downloads/android-ndk-r9c-linux-x86.tar.bz2
  • Set the JAVA_HOME, the ANDROID_SDK_HOME and ANDROID_NDK_HOME environment variables
export JAVA_HOME=~/Devel/jdk1.7.0_45/
export ANDROID_SDK_HOME=~/Devel/adt-bundle-linux-x86-20131030/sdk/
export ANDROID_NDK_HOME=~/Devel/android-ndk-r9c/
  • Install the android support library and repository. Type:
$ANDROID_SDK_HOME/tools/android

and select both packages from the Extras repository as below

  • Extract the 3rd party precompiled libraries
tar -zxvf ~/Downloads/3rdparty-android.tar.gz
  • Download the TiXI xml library into the 3rdparty folder
cd 3rdparty-android
git clone https://github.com/DLR-SC/tixi.gi
  • Prepare tixi for android build by typing in
echo  \
"#ifndef TIXI_VERSION_H
#define TIXI_VERSION_H
#define TIXI_VERSION_STRING      \"2.1.1\"
#endif" \
> tixi/src/tixi_version.h
  • Set your NDK_MODULE_PATH environment variable so that the build process finds your 3rdparty libraries:
export NDK_MODULE_PATH=~/Devel/3rdparty-android
  • Get the tigl android code with git
cd ~/Devel
git clone -b android https://github.com/DLR-SC/tigl.git
cd tigl
  • Configure tigl with cmake
cmake -DTIGL_ANDROID=ON .
  • If no errors occured during the cmake configuration step, you can do the build by typing
make

If you get an error like failed to find target android-15, please check, which android platform your Android SDK supports by entering

$ANDROID_SDK_HOME/tools/android list targets

and change the file TiGLViewerAndroid/build.gradle to your SDK target. Another 'make' will do the rest.

  • The resulting apk file can be found under TiGLViewerAndroid/build/apk

Happy coding!