Skip to content

fix(android): restore monotonic versionCode and guard releases (v0.9.17 = uninstallable) - #110

Merged
abdulsaheel merged 1 commit into
OpenStrap:mainfrom
dannymcc:fix/android-versioncode-regression
Jul 20, 2026
Merged

fix(android): restore monotonic versionCode and guard releases (v0.9.17 = uninstallable)#110
abdulsaheel merged 1 commit into
OpenStrap:mainfrom
dannymcc:fix/android-versioncode-regression

Conversation

@dannymcc

@dannymcc dannymcc commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Problem

Installing the v0.9.17 release fails on-device with a bare "App not installed" dialog. It isn't a signing issue — every official release is signed with the same keystore from CI secrets. It's a versionCode downgrade.

Actual values baked into the shipped APKs:

Release versionCode versionName
v0.9.15 48 0.9.15
v0.9.16 48 0.9.15
v0.9.17 1 0.9.17

android/app/build.gradle.kts sets versionCode = flutter.versionCode, and Flutter derives that from the +BUILD suffix in pubspec.yaml. Commit c8d75af set version: 0.9.17+1, so versionCode collapsed 48 → 1. Android refuses to install an APK whose versionCode is lower than the installed one (INSTALL_FAILED_VERSION_DOWNGRADE), shown to users as "App not installed".

(Two supporting clues: v0.9.16 is byte-for-byte identical to v0.9.15 and still reports versionName 0.9.15 — pubspec wasn't bumped for that tag either; and the release trigger is just push: tags: ['v*'], so a bad pubspec sails straight to a published release with no gate.)

Fix

  1. pubspec.yaml0.9.18+49 — restores a monotonic versionCode (49 > 48). A fresh patch release rather than re-cutting the burned v0.9.17 tag; 49 upgrades cleanly over both the versionCode-48 installs and anyone who grabbed the broken versionCode-1 build.

  2. Release-time CI guard in build.yml (runs before the build) that fails the release when the versionCode is:

    • missing the +BUILD suffix (the exact v0.9.17 footgun — Flutter would silently fall back to 1),
    • non-integer,
    • mismatched with the release tag's versionName, or
    • not strictly greater than the highest already-released versionCode.

    Needs fetch-depth: 0 on checkout so it can read prior tags' pubspec. Verified locally: passes for 0.9.18+49, and correctly rejects the 0.9.17+1 case (versionCode 1 <= prior max 48).

Note for release cutter

v0.9.17 is already published with versionCode 1 and can't be fixed in place — cut v0.9.18 from this branch once merged. Anyone who installed the broken v0.9.17 will be able to upgrade to v0.9.18 normally.

Heads-up from the pubspec comment: a version bump also needs the iOS MARKETING_VERSION/CURRENT_PROJECT_VERSION updated for the widget/watch targets in project.pbxproj. Left out of this PR to keep it Android-focused — flag if you'd like it folded in.

Summary by CodeRabbit

  • New Features

    • Added release validation to ensure Android version numbers match release tags and increase consistently.
    • Releases now stop early when version information is missing, invalid, mismatched, or not higher than previous releases.
  • Chores

    • Updated the app version to 0.9.18 (build 49).

pubspec 'version: 0.9.17+1' shipped v0.9.17 with versionCode 1, a
downgrade from v0.9.15/v0.9.16 (versionCode 48). Android blocks the
upgrade install (INSTALL_FAILED_VERSION_DOWNGRADE), surfaced to users
as "App not installed".

- bump to 0.9.18+49 so the next release installs over existing devices
- add a release-time CI guard that fails the build when the versionCode
  is missing, non-integer, mismatched with the tag, or not strictly
  greater than the highest already-released versionCode
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 56dbe96c-05e2-4b0a-85ad-e3d3bb77b004

📥 Commits

Reviewing files that changed from the base of the PR and between c8d75af and 95dc41d.

📒 Files selected for processing (2)
  • .github/workflows/build.yml
  • pubspec.yaml

📝 Walkthrough

Walkthrough

The package version is bumped to 0.9.18+49. The Android release workflow adds a pre-build guard that validates the build suffix, release tag, and strict versionCode increase across prior v* tags.

Changes

Release version validation

Layer / File(s) Summary
Version bump and release guard
.github/workflows/build.yml, pubspec.yaml
The package version changes to 0.9.18+49, and the Android workflow validates its integer build suffix, tag correspondence, and versionCode against prior v* tags before building.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Suggested reviewers: abdulsaheel

Sequence Diagram(s)

sequenceDiagram
  participant Workflow as Android release workflow
  participant Pubspec as pubspec.yaml
  participant Tags as prior v* git tags
  Workflow->>Pubspec: Read package version
  Workflow->>Tags: Read prior versionCode values
  Workflow->>Workflow: Validate tag match and increasing versionCode
  Workflow->>Workflow: Continue build when checks pass
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the Android versionCode fix and new release guard, matching the main changes in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@abdulsaheel
abdulsaheel merged commit 24c336b into OpenStrap:main Jul 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants