1.4 KiB
1.4 KiB
Android build versioning
The Android APK currently uses an app version plus a build identity:
versionNamedefaults to0.1.0+<git-short-sha>[-dirty]-<UTC epoch milliseconds>(localis used when Git is unavailable). Dirty working trees are labeled; the timestamp makes repeated local builds distinct.versionCodedefaults to the current UTC epoch seconds. Each second gets a new code, and the value remains within Android's supported range through 2038.archiveDebugApkcopies the standard debug APK toandroid/app/build/outputs/versioned-apk/ee2e-phone-calls-<version>-<build-id>-<version-code>-debug.apk.
For CI and release builds, set explicit values so build records can be mapped to a commit and CI run. Gradle project properties take precedence over environment variables:
APP_VERSION=0.1.0 \
APP_BUILD_ID=abc1234-run47 \
APP_VERSION_CODE=47 \
gradle archiveDebugApk
The equivalent Gradle properties are -PappVersion=0.1.0 -PappBuildId=abc1234-run47 -PappVersionCode=47. Use a monotonically increasing positive APP_VERSION_CODE for published releases; Android uses it to order upgrades. The default build ID records the current Git revision, working-tree state, and build time. For CI, set it to the source revision and CI run. Generated APKs remain under Gradle's ignored build/ directory and should be retained by the CI artifact store when needed.