1Prerequisites (verified on Kubuntu 18.04.3):
2- Build kstars from source according to https://indilib.org/forum/general/210-howto-building-latest-libindi-ekos.html
3- Install Android SDK
4- Download and install NDK version android-ndk-r17c.
5- Install JDK java-8-openjdk-amd64:
6    sudo apt-get install openjdk-8-jdk
7- Install Qt open source for Android (newest version 5.13.1) under your home directory to be writable.
8- After installation of Qt, enter the correct paths to the NDK, JDK and SDK in Tools>Options>Devices>Android and make sure Qt shows no warnings regarding these paths.
9- Qt does not work with the newest SDK Tools, you must use v25 as suggested here:
10  https://stackoverflow.com/questions/42754878/qt-creator-wont-list-any-available-android-build-sdks/42811774#42811774
11
12  Basically, download https://dl.google.com/android/repository/tools_r25.2.5-linux.zip and replace the ANDROID_SDK_DIR/tools directory,
13  or just use the Android SDK download tool to use this version.
14- Some tools are needed for the compilation: sudo apt-get install dos2unix ccache subversion ant libconfig-yaml-perl
15
16Edit /etc/environment and add the following environmental variables before building:
17    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$ANT_HOME/bin"
18    JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
19    QT_ANDROID="/$HOME/Qt/5.13.1/android_armv7"
20    CMAKE_ANDROID_NDK="/$HOME/Android/Sdk/ndk/android-ndk-r17c"
21    ANDROID_NDK="/$HOME/Android/Sdk/ndk/android-ndk-r17c"
22    ANDROID_SDK_ROOT="/$HOME/Android/Sdk"
23    ANDROID_API_LEVEL=17
24    ANDROID_PLATFORM=17
25    KSTARS_ROOT="/$HOME/Projects/kstars"
26    ANT_HOME="/usr/share/ant"
27
28If you want to generate signed release package set the following variables:
29    export ANDROID_KEYSTORE=your_keystore_file
30    export ANDROID_KEYSTORE_ALIAS=your_keystore_alias
31    export KSTARS_ROOT=KStars Path (e.g. /$HOME/Projects/kstars)
32
33Configure git (if you haven't done this already):
34    git config --global user.email "you@example.com"
35    git config --global user.name "Your Name"
36
37Make a build directory in a separate location form source (e.g. /$HOME/Projects/build/kstars-android):
38    - Run build_kf5.sh and verify that the script builds everything without any problem.
39    NOTE: Ki18n often fails to build the first time, but it should succeeds when you rebuild kf5 again.
40
41    $KSTARS_ROOT/packaging/android/build_kf5.sh
42
43Configure out-of-source build (MinSizeRel build type is recommended for Android):
44    cmake -B. -H$KSTARS_ROOT -DBUILD_KSTARS_LITE=ON -DCMAKE_TOOLCHAIN_FILE=$CMAKE_ANDROID_NDK/build/cmake/android.toolchain.cmake \
45      -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3/ -DCMAKE_INSTALL_PREFIX=$(pwd)/android/export -DCMAKE_BUILD_TYPE=MinSizeRel \
46      -DECM_DIR=/usr/share/ECM/cmake/ -DCMAKE_PREFIX_PATH=$QT_ANDROID \
47      -DCMAKE_AR=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
48
49Compile:
50    make -j4
51
52Download and convert the translations:
53    make convert_translations_to_android
54
55Install:
56    make -j4 install
57
58Generate the Android debug package:
59    make create-apk-debug-kstars
60
61Install the Android debug package to your phone:
62    make install-apk-debug-kstars
63
64Generate the Android release package:
65    make create-apk-release-kstars
66
67To sign a release package:
68    make sign-apk-kstars
69