react-native-maps: MapView is causing the app to crash. This was not happening a few days ago.

It was working fine before, but now my views that contain a mapview crash and only work when I take the mapview out. I have been through several issues on the react-native-maps github page that seemed similar to mine and most say it has to do with google play services that you have added in dependencies in the build.gradle and I have made changes with regard to that however nothing has changed. I checked and my maps api key is just fine and the library is set up according to the guidelines. If you know what the problem might be please comment or answer. The mapviews were working well a few days ago and now, they are not. Also, there are no logs related to the crash…the app crashes and a dialogue pops up notifying me of the crash but nothing appears on the logs.

Inside my build.gradle sdk versions…

  compileSdkVersion 23
   buildToolsVersion "23.0.3"
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23

Dependancies…

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

Inside the manifest

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

   <meta-data
  android:name="API_KEY"
  android:value=""/>

Inside the MainApplications.java

new MapsPackage(), Inside settings.gradle

include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')

How I call MapView


<MapView
      region={{            
        longitude: LONGITUDE,
        latitude: LATITUDE, 
        longitudeDelta: LONGITUDE_DELTA,
        latitudeDelta: LATITUDE_DELTA
      }
      }
      style={styles.container}
    >

Anything that might mean something: I am using geolocation to get the users location and then switch the initial region to the users current location coordinates.

Also I decided to also try run it with using one of the examples provided here, it also caused the app to crash. I am not sure what is causing this, please help.

I am using an Android phone to run and it has an sdk of 19.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 19 (1 by maintainers)

Most upvoted comments

I had the same problem, and in the android logcat I had a fatal exception error (Didn’t find class “org.apache.http.ProtocolVersion”). This fix it for me : Link

Hello, after removing and adding a new api key the map suddenly works…which is quite random. I am not sure if the issue will crop up again or not as with the previous api key it was working just fine…however some of the functionality i put it seems to be broken now…

All of this has literally just happened right now…

There were no logs unfortunately, but i had added a few new libraries (push notifications and background job) after the map which may or may not have caused the crash. However if it does happen again(as i suspect it will because whatever the problem was it has not been solved) I will try my best to get logs and send them here just in case anyone has been having a similar issue

why react-native-maps is getting crashed when coordinates is given from remote server and this is happening only when apk is build.

@AndrePech Hopefully we will get this figured out 😅

I am facing the same problem, my app ( in production ) started crash when opening any view an a map.