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! 🚀

Top comments (0)