19 lines
1.4 KiB
Markdown
19 lines
1.4 KiB
Markdown
# Android build versioning
|
|
|
|
The Android APK currently uses an app version plus a build identity:
|
|
|
|
- `versionName` defaults to `0.1.0+<git-short-sha>[-dirty]-<UTC epoch milliseconds>` (`local` is used when Git is unavailable). Dirty working trees are labeled; the timestamp makes repeated local builds distinct.
|
|
- `versionCode` defaults to the current UTC epoch seconds. Each second gets a new code, and the value remains within Android's supported range through 2038.
|
|
- `archiveDebugApk` copies the standard debug APK to `android/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:
|
|
|
|
```bash
|
|
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.
|