Building of Minuet Application on Android- Part 2

In the previous post I had talked about how cmake can be using for building Qt based android applications.

Now in this article I would like to mention about a problem that I had faced loading the JSON files in the application and how it was solved.

I wanted to access the JSON files to extract the information about the exercises. I tried to access the JSON files by providing the ANDROID absolute path but unfortunately it didn’t work. My mentor gave me a hint on how one could access the files in an alternate way.

We could use QStandardPaths for accessing the JSON files by passing the variable AppDataLocation but for that the files needed to be present in the <APPROOT>

JSON files were present in assets folder. So we added all the required to resources.qrc file and copied all the JSON files from assets folder to the root folder which completely solved the problem and as a result I was able to load all the JSON files successfully 🙂

Now I would like to discuss about the current development stage of Minuet Android application.

We have been able to load the exercises on the screen. Now we would be looking forward to adding sounds so one could guess the answer on hearing the music.

The initial look of Minuet Android

Chord

The Chord Exercise

NavigationDrawer

Navigation Drawer

Rhythm

Rhythm Exercise

We are looking forward to improving the UI of the application and add other features to the application. You can download the application from here

Any suggestions regarding the features and design of the application would be most welcomed 🙂 You can contact me on kde-edu(freenode) – ayushshah

 

 

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.