Android Build

Android build architecture, configuration, and deployment with Qbs

Android Build Reference

Technical reference for the OctoMY Android build infrastructure. OctoMY targets Android using the Qbs build system with Qt6.


Build Architecture

Qbs builds Android applications using its own packaging pipeline, without Gradle. The Android.sdk module handles:

  1. Resource compilation via AAPT2
  2. DEX compilation via d8
  3. APK/AAB assembly directly

This differs from CMake-based Qt6 projects, which use Gradle as an intermediary.


Android Version Targeting

Property Value Meaning
minSdkVersion 28 Minimum Android 9 (Pie) — Qt6 requirement
targetSdkVersion 35 Android 15 — Google Play 2025 requirement
compileSdkVersion 35 Compile against API 35

These values ensure compatibility with devices running Android 9 through Android 16, while meeting Google Play Store publishing requirements.


Project Structure

Each of the three applications has an android/ directory:

src/{agent,hub,remote}/android/
├── AndroidManifest.xml          # App manifest (package, permissions, activity)
└── res/
    ├── drawable-hdpi/icon.png   # App icon (high density)
    ├── drawable-mdpi/icon.png   # App icon (medium density)
    ├── drawable-ldpi/icon.png   # App icon (low density)
    └── values/libs.xml          # App name string resource

The signing keystore is stored separately at integration/cicd/targets/android-arm64/certificates/android_release.keystore.


AndroidManifest.xml

Each app's manifest declares the Qt6 Activity and application bindings:

<application android:name="org.qtproject.qt.android.bindings.QtApplication" ...>
    <activity android:name="org.qtproject.qt.android.bindings.QtActivity"
              android:exported="true" ...>
        <meta-data android:name="android.app.lib_name" android:value="{appname}"/>
    </activity>
    <provider android:name="androidx.core.content.FileProvider" .../>
</application>

Key elements:

Element Purpose
QtApplication Qt6 application class (handles library loading)
QtActivity Default Qt6 activity (no custom subclass needed)
android:exported="true" Required since Android 12 (API 31) for launcher activities
android.app.lib_name Name of the native shared library to load
FileProvider Required by Qt6 for file sharing intents

Per-app differences:

App Package Library Name
Agent org.octomy.agent agent
Hub org.octomy.hub hub
Remote org.octomy.remote remote

Qbs Configuration

AndroidOptions.qbs

Located at integration/qbs/imports/AndroidOptions.qbs, this Properties block configures the Android SDK when targeting Android:

Property Value Description
Android.sdk.platform "android-35" Compile SDK version
Android.sdk.packageType project.androidPackageType "apk" or "aab"
Android.sdk.aaptName "aapt2" Resource compiler
Android.sdk.dexCompilerName "d8" DEX compiler

App.qbs Android Integration

App.qbs conditionally includes Android support:

  • Dependencies: Android.sdk and Android.ndk (when targeting Android)
  • Manifest: Points Android.sdk.manifestFile to the per-app AndroidManifest.xml
  • Linker: Skips --start-group/--end-group flags (Android's lld resolves all archive symbols by default)

project.qbs

Property Default Description
androidPackageType "apk" Override with "aab" for Google Play

BuildOptions.qbs Android Guards

The following desktop-only features are disabled on Android:

  • -fstack-clash-protection (not supported by NDK)
  • -fuse-ld=mold / -fuse-ld=lld (NDK provides its own linker)
  • cpp.cxxStandardLibrary (NDK always uses libc++)

QtDepends.qbs Module Exclusions

These Qt modules are excluded on Android builds:

Module Reason
printsupport No printing support on Android
shadertools-private Desktop-only
serialport No serial port access on Android
webenginecore / webenginewidgets Not available on Android

Signing

The release keystore is at integration/cicd/targets/android-arm64/certificates/android_release.keystore. For release builds, configure signing via Qbs Android.sdk properties or environment variables.


ABI Support

OctoMY ships for arm64 (arm64-v8a) only on Android. This is a deliberate, permanent decision — armv7 / armeabi-v7a / any 32-bit ARM target is not supported and will not be re-added. The justification (no 32-bit Android hardware in the target market, Google Play 64-bit policy since 2019, libnative's JIT being fundamentally 64-bit by design) is in the root AGENTS.md under "Android architecture support" — read that before requesting armv7 support.

Supported profile

Profile ABI qbs.architecture Qt install path Typical device
android-arm64 arm64-v8a arm64 Qt/6.10.1/android_arm64_v8a Modern phones (Android 9+)

Build (example for Hub, debug APK):

qbs build -d .build/android-arm64-debug profile:android-arm64 \
    qbs.buildVariant:debug \
    project.androidOpenSslInclude:$HOME/Android/Sdk/android_openssl/ssl_3/include \
    -p hub

The helper script integration/cicd/targets/android-arm64/build-android.sh wraps these commands and adds adb install/adb shell monkey steps. See the Build for Android howto.

AAB (Google Play) bundle

For Play Store distribution, build the release variant:

qbs build profile:android-arm64 qbs.buildVariant:release project.androidPackageType:aab -p hub

arm64-v8a alone covers the vast majority of active Play Store devices.


SDK/NDK Requirements

Component Minimum Version
Android SDK Platform API 35
Android NDK r26+ (r27.2+ recommended; r28+ gains 16 KB page support)
JDK 17+ (21+ for Qt 6.11)
Qt 6.10.0+
Qbs 2.0+
Android OpenSSL ssl_3 (extracted into the SDK root)

See also

In this section
Topics
reference android build-system qbs deployment mobile
See also