Skip to content

build(android): sign release APKs with a stable keystore from secrets - #15

Merged
BlackPool25 merged 1 commit into
mainfrom
feat/android-release-signing
Aug 3, 2026
Merged

BlackPool25 merged 1 commit into
mainfrom
feat/android-release-signing

Conversation

@BlackPool25

Copy link
Copy Markdown
Owner

What & Why

Problem: every release APK was signed with the debug keystore, which is different on every machine and every CI run. Android requires the signing key to match to install an update over an existing app (INSTALL_FAILED_UPDATE_INCOMPATIBLE) — so users could never update in place (they had to uninstall first). Verified: the v1.0.0 and v1.0.1 APKs have different SHA-256 digests despite both showing CN=Android Debug.

Fix — stable release signing:

  • build.gradle.kts.template now reads android/key.properties into a signingConfigs.release block and signs the release buildType with it. When no key.properties exists it falls back to the debug key, so flutter run --release and unsigned CI dry-runs keep working.
  • release.yml stages the keystore + credentials from GitHub Actions secrets (ANDROID_KEYSTORE_BASE64 / ANDROID_KEYSTORE_PASSWORD / ANDROID_KEY_ALIAS / ANDROID_KEY_PASSWORD) after scaffolding, verifies the staged keystore with keytool, and fails loudly if the secrets are missing — publishing a debug-signed APK would silently reintroduce the update-conflict bug.
  • The keystore + key.properties stay out of git (under the already-ignored android/; confirmed with git check-ignore).

How it was tested

  • Built the APK locally with the keystore staged: signer is CN=QRStream (SHA-256 6319bb8a...), matching the keystore — not CN=Android Debug.

  • Built again without key.properties: falls back to debug signing (dev path intact).

  • flutter analyze + flutter test unaffected (no Dart changes).

  • flutter analyze + flutter test

  • Manually verified: release APK signed with the stable key; update-over-previous now possible

Checklist

  • No wire-format/codec change
  • CHANGELOG / docs updated if user-facing
  • If AI-assisted, I reviewed and understood every line

Notes for maintainer

The 4 secrets are already set in repo Settings → Secrets → Actions. The keystore itself (and its password) is a backup item — keep a copy outside the repo; losing it means future releases can no longer update over 1.0.1.

Release APKs were signed with the debug key, which differs per machine/CI
run — so every build was a different app and Android refused updates over
a previous install (INSTALL_FAILED_UPDATE_INCOMPATIBLE). The gradle
template now reads android/key.properties into signingConfigs.release
(falling back to debug signing when absent, so dev/unsigned builds still
work), and the release workflow stages the keystore + credentials from
GitHub Actions secrets (ANDROID_KEYSTORE_BASE64/PASSWORD, ANDROID_KEY_ALIAS,
ANDROID_KEY_PASSWORD), failing loudly if they are missing. Published APKs
are now signed with the same stable key, so users can update in place.
@BlackPool25
BlackPool25 merged commit 905fd2d into main Aug 3, 2026
2 checks passed
@BlackPool25
BlackPool25 deleted the feat/android-release-signing branch August 3, 2026 11:59
BlackPool25 added a commit that referenced this pull request Aug 3, 2026
PR #15 accidentally changed the Linux 'Rust release codec' step from
working-directory flutter_app/rust to flutter_app, so cargo build --release
ran in the wrong directory and the release workflow failed with 'could not
find Cargo.toml'. Restored flutter_app/rust (the Windows job already used
the correct path).
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.

1 participant