If you want to test KStars Lite without building then download the pre-built .apk file here (API 14, armeabi-v7a). Please, give me the feedback about it if possible (did you manage to run it, was the performance good enough, etc.)
- Qt for Android - You can download it here. Later we will point CMake to the folder with Qt libraries compiled for Android.
- Setup Android environment:
- Follow the instructions provided here to setup the environment
- Most probably you will find ant in you distros repositories.
- I had problems with ant when using OpenJDK but no problems with the latest Oracle JDK (version 8)
- KF5 for Android - You have to build it yourself using following instructions (you can also find instructions here):
Now open the kdesrc-buildrc file in any text editor and change the following lines:
cd /opt/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
- line 15: -DCMAKE_PREFIX_PATH= "path to Qt5 Android libraries. Example: /home/polaris/dev/Qt5.6.0/5.6/android_armv7"
- Line 42 "use-modules..." : If you want to save some time then comment it with # and add after it "use-modules kconfig ki18n kplotting". Thus only modules needed by KStars Lite will be built.
Now set environment variables and run the script:
export ANDROID_NDK="Your path to Android NDK folder"
"Your path to Android SDK folder"
export Qt5_android="path to Qt5 Android libraries. Example: /home/polaris/dev/Qt5.6.0/5.6/android_armv7"
export ANT="path to your ant installation (/usr/bin/ant on Ubuntu)"
export JAVA_HOME="path to your JDK (choose from the folders at /usr/lib/jvm/ on Ubuntu)
./kdesrc-build libintl-lite extra-cmake-modules frameworks-android
Note: It is important to have libintl-lite as a first parameter. I spent some time on figuring out that it is not built if I don't specify it explicitly. It is a dependency of KI18n without which it won't be built!
Note 2: All the environment variables set here will be used for compiling KStars Lite so please make sure that they are set before proceeding further.
- Go to your KStars source folder and set the path to source directory:
- Create in a desired location 2 folders - build for final build and export for files that will be included in apk along with the code (textures, data, icons etc.). After that set env. variable for export
- Now run CMake to configure make files:
I use ccmake to see which parameters are missing
/opt/android is a location where you downloaded and built KF5 for Android
Now this is important as you wont' be able to compile config file if you set this wrong. Use the path to KF5ConfigConfig.cmake on your system. This is needed to use host system kconfig_compiler rather than the Android version.
Optional: Set Android API. By default is 14. Set if your want to compile for specific Android version (e.g. API level 9 for devices >= 2.3.1)
-DKF5_HOST_TOOLING="Path to KF5Config cmake files e.g.
Obviously cmake has to be executed in one line with all the parameters but without comments
- Compile KStars Lite by executing:
- You think we are done? Not yet :) Now we have to create apk file and bundle all resources in it.
Allow inclusion of all extra files in apk
- Your apk is in "build/kstars_build_apk/bin/" with the name "QtApp-debug.apk"
- If you want to install it to your device from your PC do the following:
- Check that your device has USB debugging switched on and connect it via USB to your machine.
- Make sure that adb is installed (or use one from android-sdk-linux/platform-tools/adb) and run:
adb install -d kstars_build_apk/bin/QtApp-debug.apk
- Well, that's it! You now should have KStars Lite apk file. If you want to compile KStars Lite for desktops just pass -DBUILD_KSTARS_LITE=ON to cmake and enjoy it :)