AX notes · Measured case

What to check before shipping an AI-built Android app: the release gate and an R8 crash

An Android app built with an AI coding agent can run fine as a debug build and still crash the moment its release build starts. So every upload first passes a release gate, a release-build launch check and on-device tests.

By SugarMount Testing and release 5 min read Last updated

On September 23, 2026, the code shrinker R8 removed a single constructor from SugarMount's first app, Compress Image, and every release build crashed at launch. Since then each upload goes through three steps: a release gate, a launch check of the minified release build, and on-device end-to-end tests.

Scripts and numbers come from the code, changelog and on-device QA reports of SugarMount's app repository (sugar-utils), as of October 18, 2026.

Contents (6)
  1. Why did it crash when debug was fine?
  2. Step 1: what does the release gate stop?
  3. Step 2: launch the minified release build twice
  4. Step 3: what did on-device end-to-end tests find?
  5. When you let AI run the checks
  6. Frequently asked questions

Why did it crash when debug was fine?

Debug builds are not shrunk; release builds use R8 to strip code that looks unused. So there are problems that only the release build has, even when every unit test and the debug build pass.

-keep class * extends androidx.room.RoomDatabase { <init>(); }

Step 1: what does the release gate stop?

release_gate.sh <app> checks the following in order and builds no AAB if any of them fails.

CheckMistake it stops
Any PLACEHOLDER left in the config fileReleasing a freshly scaffolded app without its IDs
Any AdMob test ID leftShipping test ads (zero revenue)
Firebase config file presentA release without analytics and crash reports
Privacy policy and support URLs return HTTP 200A 404 behind the policy link in Settings or on the store listing (a policy problem)
Tests of the gate rules themselvesA broken check that silently stops nothing
Release config check, release unit tests, lint, AAB buildConfig and translation gaps that exist only in the release variant

HWP Viewer SugarDoc, which has no ads, is checked the other way round: the build fails if an ads SDK enters the release dependencies or an advertising ID permission is merged into the manifest.

Step 2: launch the minified release build twice

release_launch.sh <app> <device> installs the R8-shrunk release APK, force-stops the app and cold-starts it twice. After each launch it counts only this package's lines in the crash log since that moment, and checks that the process is alive.

Step 3: what did on-device end-to-end tests find?

Results for the three photo apps on a Galaxy S21 (Android 15), October 4, 2026, scenario by scenario:

AppPassed / failed / skipped
Compress Image24 / 2 / 2
Flip & Rotate Image25 / 4 / 1
Convert Image22 / 3 / 2

No crashes and no damaged originals; the minified release builds of all three launched cleanly both times. But there were nine major defects with five distinct causes. The biggest, shared by all three apps: if the system killed the app mid-job, the progress screen froze at 0 / 0. Neither the emulator nor the unit tests had shown it.

These tests ran after the apps had been submitted for production review, which was the wrong order. Now end-to-end tests come before submission; after the fixes, 410 unit tests, lint and all three release gates passed again before release.

Three-step diagram: release gate, two launches of the minified release build, and on-device E2E on a Galaxy S21 that found nine major defects.
The three checks every upload goes through; the last one, on a real device, found nine major defects.

When you let AI run the checks

Frequently asked questions

Can you catch R8 problems in advance?

The surest way is to actually launch a build shrunk with the release settings on a device. Debug builds and unit tests never go through shrinking, so they cannot catch a missing keep rule.

Is an emulator enough?

It was not. State loss after process death, and "keep original name" failing because of the file names the photo picker hands over, showed up only in on-device tests. Use the emulator for quick checks and a real device before release.

Are the gate scripts public?

The repository is private. The table above lists every check shared by all apps, so you can build the same thing in the same order. The HWP viewer adds checks that compare its document engine files and fonts against pinned sources.

This note is written from values SugarMount measured itself; an AI coding agent was used to draft it.

All notes on Testing and release · All AX notes