Android is officially supported by Qt through their qmake tool and QtAndroidExtras module. The application is compiled as a dynamic library that is loaded by a Java wrapper.
I managed to compile the Qt client and connect to a remote game from an Android device. Currently, text input and basic interaction are working, including scrolling the map. You better not use a smartphone though. Here's a mandatory screenshot: My modified version of freeciv can be found at https://github.com/lmoureaux/freeciv/co ... ndroid-2.6. Most changes are related to the way tilesets are loaded (apk don't work like traditional Linux packages) and the build system (to build the client as a shared object).
Here's my configure command (for an x86 target):
Code: Select all
export ANDROID_NDK_ROOT=/path/to/android/sdk
export ANDROID_NDK_ROOT=/path/to/android/ndk
export "CPP=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/i868-linux-android21-clang -E"
export CC=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android21-clang
export CXX=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android21-clang++
export LD=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android-ld
export MOCCMD=/path/to/qt/bin/moc
export MOCCMD=/path/to/qt/bin/moc
./configure --enable-client=qt \
--disable-fcmp \
--disable-ruledit \
--host=x86-linux-android \
--build=x86_64-linux-gnu \
--disable-server \
--disable-nls \
--with-qt5-root=/path/to/qt \
--with-qt5-includes=/path/to/qt/include \
--with-qt5-libs=/path/to/qt/lib \
--prefix=/ \
--with-sysroot=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot/ \
--disable-sdl-mixer \
--enable-shared \
--disable-static \
--with-android-sdk $ANDROID_SDK_ROOT \
--with-android-ndk $ANDROID_NDK_ROOT
- The --with-qt5-root argument can be used only when cross-compiling for Android. Do not add a trailing / or the app will not work
- The build host must start with x86, x86_64, armeabi-v7a or arm64-v8a
- ARM builds haven't been tested
The APK can be built using a custom target:
Code: Select all
make apk
[edit 2019-09-19] Updated configure command for cross-compilation; scrolling the map works; added Qt instructions
[edit 2019-09-28] Updated configure command for newly added Android-specific files; first mention of make apk