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.
@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)
I am facing the same problem, my app ( in production ) started crash when opening any view an a map.
Thanks @rborn ! :)
@AndrePech Hopefully we will get this figured out :sweat_smile:
@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!
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 @AndrePech try to get some crash logs, it's impossible to say what's going on without them.
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
I'll close it till we have logs to make clear what's the problem.
Please help I am facing the same problem. Three days ago it was working fine.
why react-native-maps is getting crashed when coordinates is given from remote server and this is happening only when apk is build.
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.
adb always has a log, take a better look
@rborn It is working fine on emulator and on most of the devices. It is crashing specifically on Huawei device.
Does the device have google play in place? Also could this be related maybe to the latest Huawei issues ?
@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.
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 .
remove
I'm using RN only.
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