---
title: "Raise the build number on every upload · Agent Wranglers"
url: https://agentwranglers.se/playbook/mobile-apps/signing-and-release/build-numbers
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Raise the build number on every upload

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Signing and release](https://agentwranglers.se/playbook/mobile-apps/signing-and-release.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- ID: MOB-9
- Level: Recommended
- Chapter: [Signing and release](https://agentwranglers.se/playbook/mobile-apps/signing-and-release)
- Rule: 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: 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](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/version-every-release) says. Then a crash report leads back to the code.
- 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.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Kotlin example

```kotlin
android {
    defaultConfig {
        versionCode = System.getenv("CI_RUN_NUMBER")?.toInt() ?: 1
        versionName = "3.4.0"
    }
}
```

### Plain text example

```ruby
lane :bump do
  increment_build_number(build_number: ENV.fetch("CI_RUN_NUMBER"))
  increment_version_number(version_number: "3.4.0")
end
```

## Sources

- [Apple, CFBundleVersion](https://developer.apple.com/documentation/bundleresources/information-property-list/cfbundleversion)
- [Android, Version your app](https://developer.android.com/studio/publish/versioning)

## Related rules

- [Stamp every build with its version](https://agentwranglers.se/playbook/engineering/build-test-and-deploy/version-every-release) in Engineering
- [Upload symbols for every build](https://agentwranglers.se/playbook/mobile-apps/crashes-and-quality/crash-symbols) in Mobile apps

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/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.

- Previous: [Sign release builds only in CI](https://agentwranglers.se/playbook/mobile-apps/signing-and-release/sign-in-ci)
- Next: [Test every build with internal testers first](https://agentwranglers.se/playbook/mobile-apps/signing-and-release/internal-testing)
- [Signing and release](https://agentwranglers.se/playbook/mobile-apps/signing-and-release)
