react-native-maps: Android crash when MapView is rendered

React Native Version: 0.59.10

What Happened

After entering the screen with MapView, the app crashes. There’s no error from logcat. MapView works fine in iOS but crashed in Android Originally everything works fine in my older version of react native (Forgot which version lmao), but after I update my project to 0.59.10, this app crash happen.

My MapView code:

import MapView, {Marker,PROVIDER_GOOGLE} from 'react-native-maps';

<MapView
                    initialRegion={{
                    latitude: this.state.latitude,
                    longitude: this.state.longitude,
                    latitudeDelta: 0.0922,
                    longitudeDelta: 0.0421,
                    }}
                    style={{height:'77.5%',width:'100%'}}
                    provider={PROVIDER_GOOGLE}
                    showsUserLocation={true}
                    followsUserLocation={true}
                    onUserLocationChange={location =>  this.setState({latitude:location.nativeEvent.coordinate.latitude, longitude:location.nativeEvent.coordinate.longitude})}
                >
                  <Marker
                    coordinate={{latitude: loclat, longitude: loclon}}
                    title={locname}
                />
   </MapView> 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18

Most upvoted comments

Add this line in your androidmanifest.xml file in the <application> tag:-

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

Add this line in your androidmanifest.xml file in the <application> tag:-

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

This worked for me!!! Thxxx I love u so much

Add this line in your androidmanifest.xml file in the <application> tag:-

<uses-library android:name="org.apache.http.legacy" android:required="false"/>

Thanks man! Fixed the issue

Same here, it crashes on RN 0.60 because AIRMap isn’t available on Android. I was able to get it working by excluding play-services-base and play-services-maps in app/build.gradle.

implementation(project(':react-native-maps')) {
    exclude group: 'com.google.android.gms', module: 'play-services-base'
    exclude group: 'com.google.android.gms', module: 'play-services-maps'
}

Which means, I had to manually link the dependency on Android project.

I have also excluded play-services-base and play-services-maps. However, mine is still crashing 😦

I have the same issue as @Gabsys and doing what @elkinjosetm and @agarwalnaveen22 said is not fixing the error, I have reat-native: 0.70.0 react-native-maps: 1.3.2

When I render the MapView on Android there is a crash (a critical error without logs) only a stacktrace in which appears the AirMapView

T_T