TheBlindCow

12 June 2014

KDE Software on Android

Filed under: Android,KAlgebra,KDE,KDE-Edu,my projects,Software Libre — apol @ 3:30 pm

Despite my involvement in KDE and free software operating systems, one of the features I’ve always loved from Qt is how we can use it to develop an application that can be used on any platform. Since I got my first /programmable/ phone, I’ve wanted to get my projects to work there, especially through all Nokia approaches to the issue, and I’ve managed to do so with relative success.

At some point last year I got to the conclusion that, if I wanted to remain somewhat sane, the best approach was to start focusing Android by caring about the CMake side of the issue and let QtQuick get into place, which is not in place yet, but admittedly in a much better state than a couples of years ago.

My KDE on Android approach is that any KDE project should be able to be built and bundled for Android from the sources, that is with an apk file as a result, without having to change the project sources: c++ or cmake.

I started working on this longtime ago on Qt4, but the fact that kdelibs was about to change and the poor direction of the port drove me away from bothering. Also if we want portable interfaces we want QtQuick Controls. I don’t think there’s much doubt there.

I restarted the project last November. I compiled a full Qt5 installation and started to get it to build, my intention was to use android.toolchain.cmake again, but I then decided that it would be better to create a new cmake toolchain file to have all the control I needed over how it’s being compiled. Some things need to be treated with special love like how executables are built and especially being able to create apks.

At the moment it seems to be working reasonably well, I’ve been using KAlgebra as a test. I get to easily deploy the Analitza framework which is a dependency and then consume it from KAlgebra which bundles all dependencies into a nice publishable APK.

Enough back-story, let’s see how we’d build KAlgebra (or any traditional KDE project for that matter).

To get all the features going we need:
* Qt 5.4 built for Android (currently in dev branch)
* CMake 3.0
* Android NDK
* Android Development Kit
* the ToolChain file I created (still to find a proper place, can be found here)
* Extra-CMake-Modules
* The project’s source code, because the power is in the source!

Here’s an example on how to get it done [1], but that’s the expanded version. As an attempt not to scare you here I used a simplified version, by having a cmakeandroid macro defined, passing cmake all the needed information.

mkdir build-analitza build-kalgebra
cd build-analitza && cmakeandroid ~/src/analitza && make && make install
cd build-kalgebra && cmakeandroid ~/src/kalgebra -DQTANDROID_EXPORTED_TARGET=kalgebramobile && make && make create-apk-kalgebramobile

Which I think it’s readable enough.

To conclude, we are able to consider Android as a candidate for KDE projects to adopt. There’s much more to do both on KDE, Qt and cmake sides, but we can get to discuss it when you’ve ported your application.

For the moment, I’d like to know if there’s any application that is interested in being built for Android, I’d like to give it a try, especially if it’s already been ported to QtQuick and Qt5/KF5.
Furthermore, in case anybody is interested, I’ll open a wiki page with this information, in case anybody wants to use it, for the moment my cmake toolchain and manifest can be found here:
http://quickgit.kde.org/?p=scratch%2Fapol%2Fkalgebraandroid.git

[1]

mkdir install && \
mkdir build-analitza && cd build-analitza && \
/opt/cmake-devel/bin/cmake ~kde-devel/frameworks/analitza -DCMAKE_INSTALL_PREFIX=$HOME/android/install -DCMAKE_PREFIX_PATH=$HOME/android/install -DANDROID_APK_DIR=$HOME/android/kalgebraandroid/androidpkg/ -DCMAKE_TOOLCHAIN_FILE=$HOME/android/kalgebraandroid/AndroidToolchain.cmake -DQt5_DIR=$HOME/android/qt5/qtbase/lib/cmake/Qt5/ -DQt5Core_DIR=$HOME/android/qt5/qtbase/lib/cmake/Qt5Core && \
make && make install && \
cd .. && mkdir build-kalgebra && cd build-kalgebra && \
/opt/cmake-devel/bin/cmake ~kde-devel/frameworks/kalgebra -DCMAKE_INSTALL_PREFIX=$HOME/android/install -DCMAKE_PREFIX_PATH=$HOME/android/install -DANDROID_APK_DIR=$HOME/android/kalgebraandroid/androidpkg/ -DCMAKE_TOOLCHAIN_FILE=$HOME/android/kalgebraandroid/AndroidToolchain.cmake -DQt5_DIR=$HOME/android/qt5/qtbase/lib/cmake/Qt5/ -DQt5Core_DIR=$HOME/android/qt5/qtbase/lib/cmake/Qt5Core -DQTANDROID_EXPORTED_TARGET=kalgebramobile -DMOBILE_BACKEND=qtcontrols && \
make && \
make create-apk-kalgebramobile

13 Comments »

  1. While it’s not a KDE app, I’d love to see speedcrunch ported to android.

    Comment by Santiago — 12 June 2014 @ 7:17 pm

  2. This is awesome! Can’t wait to play with these ported programs!

    Comment by Michael — 13 June 2014 @ 4:55 am

  3. Okular would be really nice. To me, this is the best PDF reader and presentation applikation.

    Amarok could also be interesting

    Comment by Jens Staal — 13 June 2014 @ 7:11 am

  4. […] KDE Software on Android […]

    Pingback by Links 13/6/2014: Docker Hype, Manjaro 0.8.10 | Techrights — 13 June 2014 @ 12:53 pm

  5. Great work !

    I’d like to see ksirk and kgraphviewer ported, but I should switch them to Qt5/QtQuick before…

    Comment by Kleag — 13 June 2014 @ 5:23 pm

  6. #5 is there anything you need to happen, besides free time? :)

    Comment by apol — 13 June 2014 @ 5:57 pm

  7. Is it really easier to port an application to Qt Quick than to make the Qt Widgets UI easily usable on touchscreens?
    I know that typical Android UIs are mostly not based on widget sets, but I think that’s mostly because the build-in widget set is not rich enough. Not using a widget set has the same consequences as it would on the desktop: UIs are ad-hoc looking, ugly, and the programmers waste time.

    Do Qt Quick Controls applications integrate with the platforms’ widget sets on KDE and other desktop platforms?

    Comment by Jacob Gypsum — 14 June 2014 @ 1:01 am

  8. #7 I haven’t seen a good QtWidgets UI on a touch screen so far. I can be wrong though.

    And yes, QtQuick Controls integrates with KDE, Windows, Mac OS X and it’s on the works to support Android on 5.4. I agree that not integrating with the OS look and feel is definitely bad, we want to integrate and Qt knows how to do that.

    Comment by apol — 14 June 2014 @ 1:21 am

  9. […] http://www.proli.net/2014/06/12/kde-software-on-android/ […]

    Pingback by Software de KDE en Android | victorhckinthefreeworld — 14 June 2014 @ 6:39 pm

  10. Hola!!

    Gran noticia, que me parece muy prometedora!
    Quizás F-droid sería un buen sitio donde encontrar ese software de KDE!! ;)
    Saludos y muchas gracias por tu trabajo!!
    ‘ve phun!

    Comment by victorhck — 14 June 2014 @ 9:11 pm

  11. “And yes, QtQuick Controls integrates with KDE, Windows, Mac OS X and it’s on the works to support Android on 5.4″

    That’s great!

    Comment by Jacob Gypsum — 14 June 2014 @ 11:58 pm

  12. #10 Gracias! :) I had some discussions with an F-Droid developer during FOSDEM, it looks doable and I think it’s an awesome place for us to be. :)

    Comment by apol — 15 June 2014 @ 10:45 pm

  13. […] Pol wrote about how to install KDE apps (this includes KDE edu) on Android devices. As we were asked for good edu apps for Tablets, this may be an option for some […]

    Pingback by Free Software in Education News – June « Being Fellow #952 of FSFE — 5 July 2014 @ 9:59 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress