Skip to content

fix: prevent Map tab crash on Android builds without a Google Maps key (#25)#26

Merged
arunrajiah merged 1 commit into
mainfrom
claude/angry-johnson-8f68b1
Jun 21, 2026
Merged

fix: prevent Map tab crash on Android builds without a Google Maps key (#25)#26
arunrajiah merged 1 commit into
mainfrom
claude/angry-johnson-8f68b1

Conversation

@arunrajiah

Copy link
Copy Markdown
Owner

Summary

Fixes #25 — the Map tab crashes on Android (grey screen → crash) for every released build.

Root cause: react-native-maps' MapView crashes the native Google Maps SDK on Android when no API key is present. Worse, app.config.ts baked an empty-value com.google.android.geo.API_KEY meta-data tag into the manifest whenever EXPO_PUBLIC_GOOGLE_MAPS_API_KEY was unset — itself a known native crash trigger — and the release workflow ran expo prebuild with that env var unset, so every published APK shipped the crash.

Changes

  • app.config.ts — only emit the googleMaps key block when a key is actually provided (never write an empty-string key); expose a hasGoogleMapsKey flag via extra.
  • app/(tabs)/map.tsx — on Android without a key, render a "Map not available in this build" fallback instead of mounting MapView, so the native map never initializes keyless. iOS (Apple Maps) is unaffected.
  • .github/workflows/release.yml — inject EXPO_PUBLIC_GOOGLE_MAPS_API_KEY at prebuild so GitHub release builds get a working map.
  • docs — correct the inaccurate "blank tiles but markers still work" claim in README, F-Droid submission notes, and the F-Droid metadata.

Why this is robust

Layer 2 makes it structurally impossible to mount the native map without a key, so the crashing code path is never reached on keyless builds — regardless of the exact native fault.

Action required after merge

Add the EXPO_PUBLIC_GOOGLE_MAPS_API_KEY repository secret. Without it, release builds show the fallback (no crash) rather than a real map.

Caveat

Diagnosed from the report + code, not from a device repro/logcat. The fix is designed to hold even if the precise native cause differs, but the one scenario it wouldn't cover is a crash that also occurs with a valid key (a pure new-architecture/Fabric incompatibility). The symptom matches the keyless signature exactly, so this is considered unlikely.

Verification

pnpm typecheck and pnpm lint both pass clean.

#25)

Mounting react-native-maps' MapView on Android without a Google Maps API
key crashes the native SDK (grey screen → crash). Every released build
shipped an empty-value com.google.android.geo.API_KEY meta-data tag —
itself a crash trigger — because prebuild ran with the env var unset.

- app.config.ts: only emit the googleMaps key block when a key is actually
  present (never write an empty-string API key); expose a hasGoogleMapsKey
  flag via extra.
- map.tsx: on Android without a key, render a fallback instead of mounting
  MapView, so the native map never initializes keyless. iOS is unaffected.
- release.yml: inject EXPO_PUBLIC_GOOGLE_MAPS_API_KEY at prebuild so GitHub
  release builds get a working map.
- docs: correct the inaccurate "blank tiles but markers still work" claim
  in README, F-Droid submission notes, and the F-Droid metadata.
@arunrajiah arunrajiah merged commit 45acacc into main Jun 21, 2026
4 checks passed
@arunrajiah arunrajiah deleted the claude/angry-johnson-8f68b1 branch June 21, 2026 20:03
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.

App crash upon opening the Map view/page

1 participant