# Android AAB versionCode Monotonic Calculator & ABI / Form-Factor Scheme Planner

> Calculate collision-free Android `versionCode` integers (`<= 2,100,000,000`) across CI/CD runs, multi-track Closed Testing updates, Wear OS / Android TV companion bundles, and Flutter `+buildNumber` / Expo `eas.json` schemas.

- **Interactive Tool URL**: https://staging.gootester.com/tools/aab-version-code-abi-scheme-calculator

## How to Use
1. **Enter your semantic `versionName` (`MAJOR.MINOR.PATCH`), CI build counter, and target form factors**: Input your current release version (for example `1.2.4`), optional GitHub Actions `$GITHUB_RUN_NUMBER` offset, and whether you ship a single universal `.aab` or separate Phone + Wear OS + Android TV bundles.
2. **Validate `2,100,000,000` ceiling headroom and multi-track shadowing rules**: Verify your integer stays safely below Play Console's `2100000000` hard cap (avoiding `YYYYMMDDHHmm` 12-digit timestamp overflows!) and exceeds the highest historical `versionCode` ever uploaded to Internal or Closed Testing.
3. **Copy ready-to-paste `build.gradle.kts`, `pubspec.yaml`, or `eas.json` snippets**: Export deterministic version formulas for Native Kotlin/Compose (`MAJOR * 1000000 + MINOR * 10000 + PATCH * 100 + PATCH_BUILD`), Flutter `--build-number`, or Expo `appVersionSource: "remote"`.
4. **Plan your Day-1, Day-5, and Day-10 Closed Testing `versionCode` iteration sequence**: Map out 3 clean monotonic builds across your 14-day GOOtester campaign and generate the matching `/api/v1/ci/release` webhook payload (`gt_live_example_token_12345`) for automated evidence tracking.

## Why Android `versionCode` Overflows and Collisions Break CI/CD Pipelines

Inside Google Play Console, `versionName` (`"1.0.2-beta"`) is purely cosmetic display text ignored by Android's `PackageManager`, whereas `versionCode` is an immutable, workspace-global integer key. Once `versionCode 10` is uploaded to *any* track (even a discarded `Internal testing` draft that you deleted before publishing!), `versionCode 10` is burned forever for that `applicationId`.
Two classic bugs break automated CI builds every week. First, vibe-coded CI scripts set `versionCode = $(date +%s)` (Unix epoch seconds, currently `~1,795,000,000` and climbing toward `2,100,000,000`) or `YYYYMMDDHH` (`2026112606`, which is `2.026 billion` — perilously close to Play Console's **`2,100,000,000` maximum limit**, and `YYYYMMDDHHmm` `202611260650` instantly crashes Gradle with a 32-bit signed integer overflow!).
Second, developers shipping a single modern Android App Bundle (`.aab`) copy obsolete 2017 Stack Overflow snippets multiplying `versionCode` by per-ABI prefixes (`1` for `armeabi-v7a`, `2` for `arm64-v8a`). With Play App Signing and `.aab` bundles, Google generates ABI split APKs automatically from **one single `versionCode`** — ABI prefix multipliers are only needed if you still maintain separate multi-APK artifacts or separate Wear OS / Android TV companion bundles!

## Multi-Track Shadowing: Internal vs. Closed vs. Wear OS Form Factors

Android devices install the highest `versionCode` entitled to the signed-in Google account. If you upload `versionCode 50` to `Internal testing` for yourself and leave `versionCode 12` on `Closed testing` for your 15 external testers, any account enrolled in *both* tracks receives `versionCode 50` — whereas promoting Closed Testing to Production later requires understanding which binary supersedes which.
If your `applicationId` also publishes a standalone **Wear OS** watch bundle or **Android TV** bundle alongside your phone `.aab`, assign clean leading-digit form-factor prefixes (for example `10010200` for Phone/Tablet `1.2.0` and `20010200` for Wear OS `1.2.0`) so watch updates and phone updates never collide in Play Console's global version table.

## Structuring a 3-Release Cadence Across Your 14-Day Closed Test

Shipping monotonic updates (`versionCode 100` on Day 1 -> `versionCode 101` on Day 5 -> `versionCode 102` on Day 10) on the same Closed Testing track never resets Google Play's 14-day consecutive opt-in counter. Instead, it creates concrete Play Console release history corroborating Question 2 of your Production Access submission.
Pair each new `.aab` rollout with a scoped `POST https://gootester.com/api/v1/ci/release` webhook call authenticated via `gt_live_example_token_12345` so GOOtester binds human tester feedback ($6/$12/$20 one-time) and separate physical-device ARM64 ADB QA (Standard/Premium) directly to the exact `versionCode` under test.

## FAQs
### What happens if I accidentally upload `versionCode 999999999` to Internal Testing?
Because Android `PackageManager` refuses downgrades and Play Console enforces monotonic ordering within tracks, any subsequent release designed to supersede `999999999` on that track must use `1000000000` or higher (up to `2100000000`). If you haven't rolled `999999999` out to Production yet, discard the draft or keep Production/Closed tracks on sane lower numbers if Internal is paused, though global uniqueness still blocks reusing exact burned integers.

### Do I need separate ABI `versionCode` multipliers for `arm64-v8a` when uploading an `.aab`?
No! Per-ABI `versionCode` multipliers were a legacy workaround for uploading multiple standalone `.apk` files. A single Android App Bundle (`.aab`) uses one unified `versionCode`, and Google Play App Signing generates ABI-specific split APKs transparently.

### How do I sync Expo EAS `autoIncrement` when Play Console already has manual uploads?
Set `"appVersionSource": "remote"` inside `eas.json` and run `npx eas-cli build:version:set -p android` to initialize EAS's remote counter strictly above the highest `versionCode` listed in Play Console's `App bundle explorer`.
