My signing plugin had unit tests. They passed. The release bundle it produced was still signed with the Android debug key, and I only found out by accident.

How it happened

A bare Expo project gets its android/ folder from expo prebuild. In that generated build.gradle, the release build type points at the debug signing config. Play Console refuses a debug-signed upload, so you have to change that line. Since expo prebuild --clean throws the folder away, I change it from a config plugin that rewrites the file on every prebuild.

The plugin looked for the old form of the line. Recent React Native templates (I noticed it on 0.81) add an equals sign:

- signingConfig signingConfigs.debug + signingConfig = signingConfigs.debug 

My regex didn't match, so the plugin quietly did nothing. The build succeeded. My tests fed the plugin a copy of the old template, so they were green too.

How I found it

Someone in the comments on my last post suggested reading the merged manifest after the build, not just app.json. While I was adding that, I ran keytool on the bundle out of curiosity:

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

The owner line said CN=Android Debug, O=Android, C=US.

If you build locally, that command is worth running once. Your own key shows your own name there. If you see Android Debug, Play will reject the file. If you're on a machine with a non-English locale, add -J-Duser.language=en so the labels come out in English.

The manifest check

The second check is the one from the comment. Play reads the manifest after every library has merged its permissions in. After a local release build, that file is here:

android/app/build/intermediates/bundle_manifest/release/processApplicationManifestReleaseForBundle/AndroidManifest.xml 

I compare it with package.json. If an ads library is installed, com.google.android.gms.permission.AD_ID has to be in that file, or the Advertising ID answer in Play Console won't match. A billing library needs com.android.vending.BILLING. And the template adds a few you probably don't use, like SYSTEM_ALERT_WINDOW.

A script for both

I put both checks in a small CLI with no dependencies. It needs Node 18+ and a JDK:

npx github:ykisoftware/expo-play-check 

It exits 1 when something will bounce, so it can sit in CI. The source is on GitHub under the same name, MIT licensed.

What I took from this: a test that runs on a fixture only proves the fixture. The bundle is the thing Play reads, so now I check the bundle.

I found this while building my Expo starter kit, which runs the same checks after each release build. It's paid and linked from the README. The script works without it.