This page present how to compile Marble for Android, using the Android SDK, Android NDK and Qt for Android, and how to deploy it to your device.
You will need the following tools:
- Android SDK - It can be downloaded from here: http://developer.android.com/sdk/index.html
- Android NDK - You can download it from here: https://developer.android.com/ndk/index.html
- Qt with support for Android devices. Download the best one for you: https://www.qt.io/download-open-source/#section-2 and install it, but be sure that the Android support is installed too (for example you have to check in to install it in the online installer).
- CMake - Usually you should be able to install it from your repository.
- Java Development Kit - For example you can install openjdk, usually it should be in your repository.
- Ant - This should be available from the repositories too.
Some Android platforms will be needed, you should install them with the Android SDK's package manager. It can be started with:
Make sure to install the following platforms:
Getting the Marble Source Code
- Start a terminal
- We download the source code by cloning the developer repository with the following command:
git clone git://anongit.kde.org/marble ~/marble/sources
After you run the git clone command (shown above), all the Marble source files and considerable resource files will be found in a folder called marble in your home directory.
Getting the Cmake toolchain for Android
First, you should change your working directory to Marble's source directory:
Then the toolchain have to be cloned from its git repository:
git clone https://github.com/LaurentGomila/qt-android-cmake.git
We will use this to compile Marble and pack it as an apk.
Setting your PATH
You have to add the following paths to your PATH:
You can get the path to the binary with:
After you know the path:
Path to your Java installation, for example:
For example, if you installed Qt in /opt/Qt you have to set the following on a 64 bit system:
And for the Android version:
And you also need to specify your target platform (e.g.: 18):
Setting up the AndroidManifest.xml
Before compiling Marble, Marbles's manifest file have to be placed at the right place. Run the following command:
cp ~/marble/sources/data/android/AndroidManifest_MarbleMaps.xml.in ~/marble/sources/qt-android-cmake/AndroidManifest.xml.in
First of all, create a build directory in marble's source dir:
Than change your working directory to it:
Then the project have to be configured with Cmake, run the following command:
cmake -DCMAKE_TOOLCHAIN_FILE=../sources/qt-android-cmake/toolchain/android.toolchain.cmake -DQTONLY=TRUE -DQT5BUILD=TRUE -DQT_NO_WEBKIT=TRUE -DQT_NO_PRINTER=TRUE ../sources/
This will generate the needed Makefile for compiling. You can start the compiling process with the following command:
Sending the application to your device
After the build successfully finished, the apk will be in the following directory:
You can send the compiled application to your connected device with the following command:
adb install -r QtApp-debug.apk