# Fix 'Version Code X Has Already Been Used. Try Another Version Code' in Play Console

> Exact Error: `Version code X has already been used. Try another version code.`

- **Canonical URL**: https://gootester.com/errors/version-code-already-used

## Step-by-Step Resolution
1. **Check the highest existing versionCode in App Bundle Explorer**: In Google Play Console, navigate to Test and release -> App bundle explorer. Sort the Version code column descending to find the highest integer ever uploaded across all active, draft, and halted tracks.
2. **Promote existing tested artifacts instead of re-uploading identical builds**: If the exact .aab you want is already inside Internal Testing or App Bundle Explorer, click 'Promote release -> Closed testing' (or 'Add from library' inside Release creation) instead of uploading the same .aab twice.
3. **Set your next build integer strictly higher than the global maximum**: Update versionCode in build.gradle.kts, +buildNumber in pubspec.yaml, ApplicationVersion in .csproj, or eas build:version:set so your new build uses max(AppBundleExplorer) + 1.
4. **Verify your new versionCode exceeds lower-priority tracks to prevent shadowing**: Ensure a tester opted into both Internal Testing and Closed Testing does not have a stale Internal Testing versionCode 50 shadowing your active Closed Testing versionCode 4.
5. **Automate monotonic versionCodes in CI/CD pipelines**: Derive versionCode from a monotonic CI run counter (e.g., BASE_OFFSET + GITHUB_RUN_NUMBER) or remote EAS/Play Developer API lookup so parallel branches never reuse integers during your 14-day closed test.

```yaml
jobs:
  build-aab:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Compute monotonic Android versionCode above Play Console max
        run: echo "ANDROID_VERSION_CODE=$((100 + GITHUB_RUN_NUMBER))" >> "$GITHUB_ENV"
      - name: Build signed Flutter / Gradle AAB
        run: flutter build appbundle --release --build-number="$ANDROID_VERSION_CODE"
      - name: Notify GOOtester CI Release Bridge
        run: |
          curl -fsSL -X POST "https://gootester.com/api/v1/ci/release" \
            -H "Authorization: Bearer gt_live_example_token_12345" \
            -H "Content-Type: application/json" \
            -d "{"package_name":"com.example.app","version_code":$ANDROID_VERSION_CODE}"
```

## How Play Console's Global `versionCode` Ledger Works

Android's package installer (`PackageManager`) and Google Play's update resolver rely exclusively on the signed 32-bit positive integer `android:versionCode` (`1` up to `2,100,000,000`) to determine whether one binary is newer than another; `versionName` (`"1.0.2-beta"`) is purely cosmetic display text. Inside Google Play Console, **App Bundle Explorer** acts as an append-only ledger scoped to your `applicationId`. The instant an `.aab` finishes uploading — even if you cancel the release wizard five seconds later without ever clicking Save or Rollout — that integer `versionCode` is permanently consumed and can never be uploaded again with different bytes.
Developers frequently run into `Version code X has already been used` when transitioning from Internal Testing into their 14-day Closed Testing campaign. If you want to deploy the *exact same* `.aab` already sitting in Internal Testing onto your Closed Testing track, do not drag-and-drop the `.aab` file a second time; instead, open Internal Testing -> `Promote release -> Closed testing`, or click `Add from library` inside the Closed Testing release editor to select the already-stored artifact from App Bundle Explorer.
Every artifact stored inside App Bundle Explorer also retains its associated ProGuard/R8 `mapping.txt` file and native debug symbol ZIP permanently, allowing you to promote an already-verified Internal Testing candidate into Closed Testing with zero re-compilation risk.

## Avoiding Track Shadowing Between Internal and Closed Testing

A closely related trap occurs when developers experiment with timestamp-based version codes (such as `20261101` in Internal Testing) and later switch back to clean sequential integers (`2`, `3`, `4`) for Closed Testing. Although Play Console allows uploading `versionCode 4` if `4` itself was never used, any tester or developer device enrolled in Internal Testing will continue receiving `20261101` because `20261101 > 4`! Worse, Play Console displays a `Version code X is shadowed by version code Y` warning if a lower-priority track holds a higher version number.
Before starting your 12-tester, 14-day Closed Testing window, check `App bundle explorer`, identify the highest integer ever uploaded, and set your Closed Testing baseline strictly above it (for example jumping cleanly to `101`, `102`, `103`, while pausing or updating stale Internal Testing tracks).
Keep your developer account email removed from Internal Testing tester lists on devices where you want to verify the exact Closed Testing Play Store binary served to external participants, eliminating cross-track version shadowing confusion.

## Clean Version Lineage Across Your 14-Day GOOtester Campaign

Shipping two or three monotonically increasing `.aab` releases during your 14-to-24-day closed test (`versionCode 101` -> `102` -> `103`) does **not** reset Google Play's 14-consecutive-day opt-in counter. Instead, it creates an auditable progression of tester-driven improvements inside Play Console.
When paired with GOOtester's scoped CI webhook (`/api/v1/ci/release`), each `versionCode` bump records release timestamps alongside your separate physical-device ADB QA runs ($12 Standard and $20 Premium plans) and human tester feedback — giving you crisp version references when answering Google Play's Production Access questionnaire.
Use GOOtester's `/tools/release-notes-changelog-generator` whenever cutting a new `versionCode` to format localized `<en-US>` Play Console What's New notes within Google's strict 500-character per-locale limit.
