MOB-9Recommended
Raise the build number on every upload
Give every store upload a build number higher than the last one, taken from CI. Keep the version people see separate from the build number.
How to do it
Google Play refuses a versionCode it has seen before, and the largest it accepts is 2100000000. Apple reads CFBundleVersion as the build number and CFBundleShortVersionString as the version people see. Use the CI run number, or a number made from the date, so two branches never pick the same one. Stamp the commit into the build as stamp every build with its version says. Then a crash report leads back to the code.
Examples
Kotlin example
android {
defaultConfig {
versionCode = System.getenv("CI_RUN_NUMBER")?.toInt() ?: 1
versionName = "3.4.0"
}
}
Plain text example
lane :bump do
increment_build_number(build_number: ENV.fetch("CI_RUN_NUMBER"))
increment_version_number(version_number: "3.4.0")
end
How to check
CI fails when the new build number is not higher than the last one in each store. The about screen shows both the version and the build number.
Sources
Related rules
- Stamp every build with its version in Engineering
- Upload symbols for every build in Mobile apps
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/mobile-apps/signing-and-release/build-numbers">Agent Wranglers mobile apps playbook</a>. In code you write, add a comment next to it with the same link.