Commit e96636c6 authored by Volker Krause's avatar Volker Krause
Browse files

Set the APK version based on what is defined in CMake

Most of the existing solutions we have do this by patching the manifest in
the source directory, due to what androiddeployqt expects. This approach
uses Gradle's built-in mechanisms instead, which basically gives us a
hook into the middle of androiddeployqt's processing. To pass values from
CMake to Gradle we use a file we can include in the build.gradle file and
that we place next to androiddeployqt's working directory.

This also does the automatic version code bumping via Gradle that is
currently done by the nightly build script on binary factory, as we need
the same for all other builds as well.
parent d9d2bafb
......@@ -95,6 +95,8 @@ if (ANDROID)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/android/ ${CMAKE_BINARY_DIR}/version.gradle)
......@@ -7,8 +7,8 @@
<manifest xmlns:android=""
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
......@@ -23,6 +23,8 @@ repositories {
apply plugin: ''
apply from: '../version.gradle'
def timestamp = (int)(new Date().getTime()/1000)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
......@@ -73,6 +75,7 @@ android {
defaultConfig {
minSdkVersion qtMinSdkVersion
targetSdkVersion qtTargetSdkVersion
manifestPlaceholders = [versionName: projectVersionFull, versionCode: timestamp]
packagingOptions {
// SPDX-FileCopyrightText: 2021 Volker Krause <>
// SPDX-License-Identifier: BSD-3-Clause
ext {
projectVersionFull = "@PROJECT_VERSION@"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment