Skip to content
4 min

My Flutter release build passed. It was signed with the debug key.

flutter build appbundle --release, green tick, 38.7 MB. keytool said CN=Android Debug. How it happens on CI, and four lines of Gradle that stop it.

  • Flutter
  • Android
  • CI/CD
  • Play Store
A parcel stamped RELEASE with a green tick, wearing a visitor badge that reads CN=Android Debug, next to a terminal showing keytool output for app-release.aab.

flutter build appbundle --release finished. Green tick, app-release.aab, 38.7 MB, exit 0 in 5.58 seconds.

Then I ran this on it:

$ keytool -printcert -jarfile app-release.aab
Owner: CN=Android Debug, OU=Android, O=Android, L=Android, ST=Android, C=IN

A release build, signed with the debug key.

This was a lab. I took a fresh Flutter 3.41 app and broke Android release signing seven ways, one release build each. Four of the broken ones fail with an error. This one is the only broken setup that passes.

Two ways to end up here

The first is the untouched Flutter template. Out of the box, the release build type signs with the debug config. Fine for trying things, wrong for Play.

The second is the one real apps ship with. A lot of guides show a build.gradle.kts that loads key.properties if it exists, and quietly uses the debug key if it doesn't. On your laptop the file is there and everything is fine. On a fresh clone, or a CI runner where nobody wrote the file, the build still passes. Just with the wrong key.

Play does check the upload key on every bundle, so this gets refused at upload. But by then you've already shipped it through your whole pipeline with a green tick on it.

No key, no release

What I use now goes above android { } in android/app/build.gradle.kts:

val keystorePropertiesFile = rootProject.file("key.properties")
val wantsRelease = gradle.startParameter.taskNames
    .any { it.contains("Release", ignoreCase = true) }
if (wantsRelease && !keystorePropertiesFile.exists()) {
    throw GradleException("android/key.properties is missing. " +
        "Refusing to build a release signed with the debug key.")
}

Same missing file, with this in place:

* What went wrong:
android/key.properties is missing.
Refusing to build a release signed
with the debug key.

BUILD FAILED in 2s

A failed build on CI costs two minutes. A debug-signed upload costs a whole review cycle.

The other one that wastes hours

While I was making the key the way most guides show it, keytool printed this, and I nearly missed it:

$ keytool -genkeypair -v -keystore upload-keystore.jks -keyalg RSA -keysize 2048 \
    -validity 10000 -alias upload -storepass labstore123 -keypass labkey456
Warning: Different store and key passwords not supported for PKCS12 KeyStores.
Ignoring user-specified -keypass value.

The file ends in .jks but it's PKCS12. The key password I gave was thrown away, and the key's password is the store password. So with keyPassword=labkey456 in key.properties the build says:

Failed to read key upload from store "<project>/android/upload-keystore.jks":
Get Key failed: Given final block not properly padded.

I typed that password correctly. The fix is to set keyPassword to the same value as storePassword. Nothing else changed and it built.

Check before every upload

keytool -printcert -jarfile build/app/outputs/bundle/release/app-release.aab

Your name in Owner: is a pass. CN=Android Debug means stop.

All seven setups, the four checks I run on every bundle (signer, versionCode and targetSdk, 16 KB page size, download size) and Play's December 2026 rules are in Play Store Release: Signed Right. It's free.

Useful to someone on your team?