Skip to content

Shrink release APK 68% and fix broken release bundling#59

Merged
dfalling merged 1 commit into
mainfrom
evaluate-tech
Jul 10, 2026
Merged

Shrink release APK 68% and fix broken release bundling#59
dfalling merged 1 commit into
mainfrom
evaluate-tech

Conversation

@dfalling

Copy link
Copy Markdown
Owner

Summary

Three small config changes (no product code), measured with real assembleRelease builds.

Fixes a broken release build. The release JS bundle could not build at all: graphql v17 ships .mjs using export * as Kind from ... (export-namespace-from), which the RN Babel preset doesn't transform. CI only runs assembleDebug — Metro serves JS live and skips bundling — so it never surfaced, but any v* release tag would have failed. Adding @babel/plugin-transform-export-namespace-from (already a transitive dep) fixes it.

Shrinks the shipped APK ~68%: 110 MB → 35 MB.

Build APK size Build time
All 4 ABIs (previous) 110 MB ~4 min
arm64-v8a only 39 MB ~35 s
arm64-v8a + R8 + resource shrink 35 MB ~19 s
  • arm64-v8a only — the dominant lever (110 → 39 MB). x86/x86_64 are emulator-only and armeabi-v7a is pre-2017 32-bit; GrapheneOS/Pixels and modern stock Android are all 64-bit ARM. Also ~4× faster builds. Debug on x86_64 emulators still works via -PreactNativeArchitectures=x86_64.
  • R8 + resource shrinking — smaller lever (39 → 35 MB; shrinks dex 17.5 → 5.6 MB).

Notes / risk

  • R8 warrants one on-device smoke test before the first release — minification can strip reflection-accessed code in native modules. Net benefit here is only ~4 MB; if you'd rather play it safe, set enableProguardInReleaseBuilds = false and you're still at 39 MB.
  • Verified: tsc, biome, jest all pass; release APK builds and is structurally correct (single ABI, all expected libs + bundle present). Not runtime-verified — no arm64 device/emulator available in this environment.

The release JS bundle could not build at all: graphql v17 ships .mjs using
`export * as Kind from ...`, which the RN Babel preset doesn't transform. CI
only runs assembleDebug (Metro serves JS live, no bundling), so it never
surfaced — but any v* release tag would have failed. Add the
export-namespace-from Babel plugin to fix it.

Also cut the shipped APK ~68% (110 MB -> 35 MB) with no product-code changes:
ship arm64-v8a only (every target device is 64-bit ARM; the other three ABIs
are dead weight and also 4x the build time), and enable R8 + resource
shrinking on release builds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dfalling
dfalling merged commit f0688bc into main Jul 10, 2026
2 checks passed
@dfalling
dfalling deleted the evaluate-tech branch July 10, 2026 22:50
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