Android is currently ''the'' mobile platform regarding market share and number of provided applications. Hence, it is a platform very well suited to increase the availability and usage of applications by the KDE community. In the following, we give an overview of the technical steps required to setup a build system for cross-compiling a Qt5/KF5 based Android application, the necessary steps to deploy it, and a reference list of the porting steps by different applications/people.
Android is currently ''the'' mobile platform regarding market share and number of provided applications. Hence, it is a platform very well suited to increase the availability and usage of applications by the KDE community. In the following, we give an overview of the technical steps required to setup a build system for cross-compiling a Qt5/KF5 based Android application, the necessary steps to deploy it, and a reference list of the porting steps by different applications/people.
= Tutorial for Building Applications on Android =
If you enter the field of cross-compiling and Qt on Android for the first time, the best start is to follow our tutorial:
For building Qt applications on Android, some extra steps are required in comparison to building directly on Linux. The following instruction expects that KF5/Qt5 based applications can already be built and all necessary tools are installed (gcc, cmake, git,...). The main idea for the setup is that we use precompiled Qt libraries (named NDK and SDK), which are built for the ARM-based Android platform. All building then is done by using these libraries. Still the build-process itself will use the tools from your Linux system (in the following called "host system"; while the Android device is called "target system"). The additional tools mostly are the Java Development Kit and other tools for building Java applications.
* [[Android/Tutorial|KDE an Android Tutorial]]
== Build Environment ==
== Build Environment ==
Line 60:
Line 60:
The following frameworks cannot yet be built and block building of further Tier 1 frameworks:
The following frameworks cannot yet be built and block building of further Tier 1 frameworks:
* kcoreaddons: unix specific backend not compatible with Android's libc
* kcoreaddons: unix specific backend not compatible with Android's libc
== "Hello KWorld" example ==
Simple example how to create Qt-based apps for Android using CMake and ECM.
Take a simple "Hello world" example app using QtQuick2 with a resource file:
It's CMakeLists.txt files would be the same as for a normal/desktop application. All special setup for the target system is done via the toolchain file, which is passed via the cmake parameter on the commandline.
Well, almost the same currently with ECM < 5.15.0, as some issues need work-arounds still to be done. See the section in the <tt>if</tt> in the toplevel CMakeLists.txt:
<syntaxhighlight lang="cmake">
project(hellokandroid)
# AndroidToolchain needs it
cmake_minimum_required(VERSION 3.1.0)
set(QT_REQUIRED_VERSION 5.3.0)
find_package(Qt5Qml)
find_package(Qt5Quick)
if (CMAKE_SYSTEM_NAME STREQUAL Android)
find_package(ECM)
# TODO: possibly should be setup by toolchain one day
When creating the APK package, as with normal Android apps a manifest file is needed which describes what the package contains and needs, named AndroidManifest.xml. For a simple application that should appear on the app grid this would be the minimum needed with an Qt-based app:
"android:label" would be the display name of your app. For the icon to be used for your app, "android:icon" defines it. The value "@drawable/kde" refers to an icon in PNG format, that is to be found in a subdir "res/drawable" relative to the manifest file, in our case "res/drawable/kde.png".
Get the complete example code, incl. step-by-step build instructions with workarounds for current issues in ECM < 5.15.0, by git clone git://anongit.kde.org/scratch/kossebau/hellokandroid.git
= Further References =
= Further References =
Revision as of 10:27, 13 March 2016
KDE Software on Android
Android is currently the mobile platform regarding market share and number of provided applications. Hence, it is a platform very well suited to increase the availability and usage of applications by the KDE community. In the following, we give an overview of the technical steps required to setup a build system for cross-compiling a Qt5/KF5 based Android application, the necessary steps to deploy it, and a reference list of the porting steps by different applications/people.
If you enter the field of cross-compiling and Qt on Android for the first time, the best start is to follow our tutorial:
/PATH/TO/ECM/toolchain/Android.cmake must be replaced with the actual path to toolchain/Android.cmake, if using the docker image it probably is at /opt/android/kde/install/share/ECM/toolchain/Android.cmake
make install/strip strips build symbols from the binaries and reduces sizes considerably
Building with KDESRC-BUILD
For building the below mentioned frameworks on Android, you can use the following kdesrc-buildrc config file:
See ECM Toolchain documentation, to be added here as example
Status of KDE Frameworks 5
The following frameworks can currently be used for Qt5/KF5 based applications. They are not (yet?) provided as precompiled libraries but can easily be compiled via kdesrc-build.
Built Successfully
kconfig (note: unit tests must be disabled)
kcompletion
kitemmodels
kitemviews
kcodecs
karchive
kguiaddons
kwidgetsaddons
attica
kdnssd
kapidox
kimageformats
kplotting
ki18n (libintl-lite is required, since BIONIC does not fully support gettext)
Current Blockers
The following frameworks cannot yet be built and block building of further Tier 1 frameworks:
kcoreaddons: unix specific backend not compatible with Android's libc