Reputation: 2553
I try to use react-native-maps
. I tried like this :
<View style={styles.container}>
<MapView style={styles.map}
region={{
latitude: this.state.latitude,
longitude:this.state.longitude,
latitudeDelta:0.1,
longitudeDelta:0.1,
}}
>
<Marker
coordinate= {{
latitude: 38.41885,
longitude: 27.12872,
}}
title={'my marker'}
description={'test'}
/>
</MapView>
</View>
however when I start app, app close immediately. I couldn understand why it close ?
Upvotes: 0
Views: 196
Reputation: 904
Try this, if it does not work check your Android Emulator if it has a Google Play Services.
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-maps:+'
For addition, add this.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="yourApiKey"
/>
Add the apiKey, after this code:
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
So it should be like this:
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="yourAPIkey"
/>
Upvotes: 1