DEV Community

Aurel Statnik
Aurel Statnik

Posted on

Issue with MapView in Expo: Works in Dev Mode but Crashes in Production

Facing a peculiar issue here and turning to the community for some guidance. Everything seems smooth in dev mode, but when I build for production or create an apk file, opening the map leads to a crash. Strangely, this issue is Android-specific; on iOS, it works like a charm.

🤔 Anybody else come across a similar situation? How did you tackle it?

Here's a quick rundown of the problem:

Scenario: Using Expo with MapView in the project.
Issue: All good in dev mode, but crashes in production or when building an apk.
iOS vs. Android: Problem only occurs on Android; iOS is unaffected.

import MapView, { Marker } from "react-native-maps";
// ...

<MapView
  style={styles.map}
  region={mapRegion}
  loadingEnabled={true}
  loadingBackgroundColor={Colors.background}
  loadingIndicatorColor={Colors.primary.primary_main}
  onPress={onPressSetGeoInfo}
>
  <Marker
    coordinate={mapRegion}
    title={showMarker(marker)}
    image={require('../../assets/location_on.png')}
  />
</MapView>
Enter fullscreen mode Exit fullscreen mode

Appreciate any advice or insights! Maybe someone has already dealt with this and knows what's up.

🙌 Thanks in advance for your support and ideas! 🚀

Sentry mobile image

Tired of users complaining about slow app loading and janky UI?

Improve performance with key strategies like TTID/TTFD & app start analysis.

Read the blog post

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay