Building of Minuet Application on Android- Part 1

Hi all. I have started working with KDE on building Minuet Mobile as my GSoC’16 project.

The aim of my project is to port Minuet Desktop Application to Android.

Well the journey begun on 26th of May, 2016(PS: My exams were on till 26th May) and believe me when I say I have learned a lot during this ongoing period. I have faced many problems during this time but I was able to combat those problems  with the help of my mentor Sandro Andrade. He has been very supportive and helpful during this period and I am very thankful to him.

Well, I and my mentor have started developing the application on Android. The development phase started with building the android application using cmake commands. Then we went on to loading the exercises on the screen. Our next task is to improve and polish UI and include the sounds to be played for every exercise.

I wanted to mention about how we build the android application using cmake and Qt. And also wanted to talk about how the Exercise View was implemented.

We first started with building the application using cmake.

You can test the basic version of Minuet(still in development phase) by building it yourself.

The required dependencies are as followed

Qt for Android. You can download it from their official website.
Set up Android NDK and SDK
Kf5 Frameworks. For official build instructions you can look over here
Ant
JAVA (openJDK)

Building KF5 for Android

$ cd “your path” (It is preferable to build KF5 for Android libaraies along side NDK and SDK. Example /home/ayush/android)
$ git clone git://anongit.kde.org/scratch/cordlandwehr/kdesrc-conf-android.git
$ mkdir -p extragear/kdesrc-build
$ git clone git://anongit.kde.org/kdesrc-build extragear/kdesrc-build
$ ln -s extragear/kdesrc-build/kdesrc-build kdesrc-build
$ ln -s kdesrc-conf-android/kdesrc-buildrc kdesrc-buildrc

Once the above steps are completed open kdesrc-buildrc and change the following line to point to the insatlled location of Qt for Android

line 15: -DCMAKE_PREFIX_PATH= “path to your Qt5 Android libraries”  Example: /home/ayush/Qt5.5/5.5/android_armv7″

Setting up the Environment variables

$ export JAVA_HOME=”path to openJDK”
$ export ANT=”path to ANT”
$ export Qt5_android=”path to Qt for Android libraries”
$ export ANDROID_SDK_ROOT=”path to SDK”
$ export PATH=$ANDROID_SDK_ROOT/platform-tools/:$PATH
$ export ANDROID_NDK=”path to NDK”

Example

$ export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
$ export ANT=/usr/bin/ant
$ export Qt5_android=/home/ayush/Qt5.5.1/5.5/android_armv7
$ export ANDROID_SDK_ROOT=/home/ayush/android/android-sdk-linux/
$ export PATH=$ANDROID_SDK_ROOT/platform-tools/:$PATH
$ export ANDROID_NDK=/home/ayush/android/android-ndk-r10e/

Run the following script to set up all KDE android frameworks and ECM

$ ./kdesrc-build libintl-lite extra-cmake-modules frameworks-android
Note you might need to be a sudo user for it.

Building instructions

You will need to first clone the minuetandroid repository by running the following command

$ git clone -b minuetandroid git://anongit.kde.org/minuet

Once the files have been cloned completely follow the steps given below
$ export minuetandroid_DIR=`pwd`
$ mkdir -p export/minuetandroid
$ cd export/minuetandroid
$ mkdir -p ../../build/minuetandroid
$ cd ../../build/minuetandroid
$ export minuetandroid_PRODUCT_DIR=`pwd`

Once you have finished the above commands, you are good to start with running the cmake command to build the application.

$ cmake “${minuetandroid_DIR}” -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=”${Qt5_android}” \
-DCMAKE_INSTALL_PREFIX=”${minuetandroid_PRODUCT_DIR}” \
-DQTANDROID_EXPORTED_TARGET=minuetandroid \
-DANDROID_APK_DIR=”${minuetandroid_DIR}”/data \
-DKF5I18n_DIR=/opt/android/kde/install/lib/cmake/KF5I18n/

$ make install/strip
“install/strip” makes sure the binaries only have minimal stuff needed to run.

It is compulsory to run the following command else you will get an error. ECM toolchain expects us to have a directory
$ mkdir -p “${minuetandroid_PRODUCT_DIR}”/lib/qml

Executing this command will create an apk
$ make create-apk-minuetandroid

You can install the application on your phone (Android to be specific) using the suggested command
$ adb install -r minuetandroid_build_apk/bin/QtApp-debug.apk

Now you have a Minuet Android application using cmake.

Advertisements

One thought on “Building of Minuet Application on Android- Part 1

  1. Pingback: Building of Minuet Application on Android https://ayushashah.wordpr… | Dr. Roy Schestowitz (罗伊)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s