react-native-maps icon indicating copy to clipboard operation
react-native-maps copied to clipboard

MapView is causing the app to crash. This was not happening a few days ago.

Open CarrieKami opened this issue 8 years ago • 19 comments

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.

CarrieKami avatar Feb 28 '18 17:02 CarrieKami

@CarrieKami please remove your api key from the comment. Would be a good idea to reject it from the google console too and create another one for your project as there are bots scanning github for keys to use them for own purposes (usually malicious ones)

rborn avatar Feb 28 '18 19:02 rborn

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

AndrePech avatar Mar 01 '18 11:03 AndrePech

Thanks @rborn ! :)

CarrieKami avatar Mar 01 '18 15:03 CarrieKami

@AndrePech Hopefully we will get this figured out :sweat_smile:

CarrieKami avatar Mar 01 '18 15:03 CarrieKami

@CarrieKami Yes, hopefully =D

By the way, another app of mine (that also makes use of this lib) is not crashing and the maps are working!

AndrePech avatar Mar 01 '18 17:03 AndrePech

I am wondering as to whether or not this has to do with any libraries or anything else i have set up on the app....i think i will make a react-native project with nothing else but a map, just to see if it will crash when it is on its own.

Do you have any new ideas as to what may be causing this @AndrePech ?

CarrieKami avatar Mar 07 '18 03:03 CarrieKami

@CarrieKami @AndrePech try to get some crash logs, it's impossible to say what's going on without them.

rborn avatar Mar 07 '18 10:03 rborn

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

CarrieKami avatar Mar 07 '18 17:03 CarrieKami

I'll close it till we have logs to make clear what's the problem.

alvelig avatar Mar 12 '18 01:03 alvelig

Please help I am facing the same problem. Three days ago it was working fine.

vipin-developer avatar Mar 30 '19 12:03 vipin-developer

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

TusharGuptaAdinav avatar Apr 06 '19 08:04 TusharGuptaAdinav

I'm also facing the same issue. Same API key is working fine on a different project. Even the example given in docs is crashing. I checked the library dependencies. Everything is fine and is consistent with another working project. There are no logs, the app is crashing as soon as the MapView renders.

iamshadmirza avatar May 29 '19 05:05 iamshadmirza

adb always has a log, take a better look

rborn avatar May 29 '19 06:05 rborn

@rborn It is working fine on emulator and on most of the devices. It is crashing specifically on Huawei device.

iamshadmirza avatar May 29 '19 06:05 iamshadmirza

Does the device have google play in place? Also could this be related maybe to the latest Huawei issues ?

rborn avatar May 29 '19 07:05 rborn

@rborn Yes, other apps are working fine. I created a new package and copied all the code. It started working now, somehow. I still don't know what was causing this issue. Also, I checked with multiple Huawei devices, this issue persists in each one of them.

iamshadmirza avatar May 29 '19 11:05 iamshadmirza

Please remove expo n move reactnative.

On Wed 29 May, 2019, 12:16 PM Mohd Shad Mirza, [email protected] wrote:

@rborn https://github.com/rborn It is working fine on emulator and on most of the devices. It is crashing specifically on Huawei device.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/react-native-community/react-native-maps/issues/2046?email_source=notifications&email_token=AIJYN4VLRPU2XRCDKXSRI2DPXYRERA5CNFSM4ES4IAM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWOK4NQ#issuecomment-496807478, or mute the thread https://github.com/notifications/unsubscribe-auth/AIJYN4TQ2C4DPZCA6YTJAPDPXYRERANCNFSM4ES4IAMQ .

TusharGuptaAdinav avatar May 29 '19 17:05 TusharGuptaAdinav

remove

I'm using RN only.

iamshadmirza avatar May 30 '19 04:05 iamshadmirza

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

alexis-regnaud avatar Aug 14 '19 08:08 alexis-regnaud