Marble/AndroidCompiling: Difference between revisions

From KDE Community Wiki
*>PGabor
No edit summary
*>PGabor
No edit summary
Line 9: Line 9:
# Android NDK - You can download it from here: https://developer.android.com/ndk/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).
# 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 respository.
# 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 respository.
# Java Development Kit - For example you can install openjdk, usually it should be in your repository.
# Ant - This should be available from the respositories too.
# 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:
Some Android platforms will be needed, you should install them with the Android SDK's package manager. It can be started with:
Line 29: Line 29:


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.
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:
<syntaxhighlight lang="bash">cd ~/marble/source</syntaxhighlight>
Then the toolchain have to be cloned from its git repository:
<syntaxhighlight lang="bash">git clone https://github.com/LaurentGomila/qt-android-cmake.git</syntaxhighlight>
We will use this to compile Marble and pack it as an apk.


=== Setting your PATH ===
=== Setting your PATH ===
Line 50: Line 57:


For example, if you installed Qt in /opt/Qt you have to set the following on a 64 bit system:
For example, if you installed Qt in /opt/Qt you have to set the following on a 64 bit system:
<syntaxhighlight lang="bash">export QT5_HOST=/opt/Qt/5.4/gcc_64</syntaxhighlight>
<syntaxhighlight lang="bash">export Qt5_host=/opt/Qt/5.4/gcc_64</syntaxhighlight>
And for the Android version:
And for the Android version:
<syntaxhighlight lang="bash">export QT5_ANDROID=/opt/Qt/5.4/android_armv7</syntaxhighlight>
<syntaxhighlight lang="bash">export Qt5_android=/opt/Qt/5.4/android_armv7</syntaxhighlight>
 


=== Compiling Marble ===
=== Compiling Marble ===
Line 60: Line 66:
Than change your working directory to it:
Than change your working directory to it:
<syntaxhighlight lang="bash">cd ~/marble/build</syntaxhighlight>
<syntaxhighlight lang="bash">cd ~/marble/build</syntaxhighlight>
 
Then the project have to be configured with Cmake, run the following command:
{{construction}}
<syntaxhighlight lang="bash">cmake -DCMAKE_TOOLCHAIN_FILE=~/marble/sources/qt-android-cmake/toolchain/android.toolchain.cmake ../sources/
</syntaxhighlight>
This will generate the needed Makefile for compiling. You can start the compiling process with the following command:
<syntaxhighlight lang="bash">make</syntaxhighlight>


=== Sending the application to your device ===
=== Sending the application to your device ===
After the build successfully finished, the apk will be in the following directory:
<syntaxhighlight lang="bash">cd ~/marble/build/src/bin/</syntaxhighlight> 
You can send the compiled application to your connected device with the following command:
You can send the compiled application to your connected device with the following command:
<syntaxhighlight lang="bash">adb install -r marble.apk</syntaxhighlight>
<syntaxhighlight lang="bash">adb install -r QtApp-debug.apk</syntaxhighlight>

Revision as of 13:14, 10 June 2015

 
Under Construction
This is a new page, currently under construction!


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.

Prerequisites

You will need the following tools:

  1. Android SDK - It can be downloaded from here: http://developer.android.com/sdk/index.html
  2. Android NDK - You can download it from here: https://developer.android.com/ndk/index.html
  3. 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).
  4. CMake - Usually you should be able to install it from your repository.
  5. Java Development Kit - For example you can install openjdk, usually it should be in your repository.
  6. 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:

  1. /path_where_you_installed_the_sdk/tools/android sdk
    

Make sure to install the following platforms:

  1. 10
  2. 11
  3. 16
  4. 18
  5. 19

Getting the Marble Source Code

  1. Start a terminal
  2. 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:

cd ~/marble/source

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:

Android NDK:

export ANDROID_NDK=/path_to_your_NDK_install

Android SDK:

export ANDROID_SDK=/path_to_your_SDK_install

Ant:

You can get the path to the binary with:

whereis ant

After you know the path:

export ANT=/path_to_ant

Java:

Path to your Java installation, for example:

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk

Qt:

For example, if you installed Qt in /opt/Qt you have to set the following on a 64 bit system:

export Qt5_host=/opt/Qt/5.4/gcc_64

And for the Android version:

export Qt5_android=/opt/Qt/5.4/android_armv7

Compiling Marble

First of all, create a build directory in marble's source dir:

mkdir ~/marble/build

Than change your working directory to it:

cd ~/marble/build

Then the project have to be configured with Cmake, run the following command:

cmake -DCMAKE_TOOLCHAIN_FILE=~/marble/sources/qt-android-cmake/toolchain/android.toolchain.cmake ../sources/

This will generate the needed Makefile for compiling. You can start the compiling process with the following command:

make

Sending the application to your device

After the build successfully finished, the apk will be in the following directory:

cd ~/marble/build/src/bin/

You can send the compiled application to your connected device with the following command:

adb install -r QtApp-debug.apk