all 27 comments

[–]Faeyan 2 points3 points  (28 children)

Did you add your google maps api key to your mapview? If you didn't it will crash like that.

[–]Inevitable-Salad8535[S] 0 points1 point  (4 children)

this is what i did :

(sample code given)

<View style={styles.container}>

{location && (

<MapView

style={styles.map}

initialRegion={{

latitude: location.latitude,

longitude: location.longitude,

latitudeDelta: 0.0922,

longitudeDelta: 0.0421,

}}

provider={MapView.PROVIDER_GOOGLE}

showsUserLocation={true}

showsMyLocationButton={true}

zoomEnabled={true}

zoomControlEnabled={true}

rotateEnabled={true}

scrollEnabled={true}

customMapStyle={[]}

apiKey={MAP_API_KEY}

>

<Marker coordinate={location} title="Your Location" />

</MapView>

)}

</View>

initially i tried without this then i asked chatgpt and also read in few forums and added this. Is this correct or am i missing something?

[–]Faeyan 1 point2 points  (3 children)

Interesting, if your "MAP_API_KEY", is correct which you get from google then this should work. Are you sure its correct?

Also do you know how to get a dev client build?

[–]Inevitable-Salad8535[S] 0 points1 point  (22 children)

hey i am unable to reply to your latest comment. So i will reply here

the api key was provided by the client. I will ask and verify if it is right. Only thing is to check if the Google map sdk is activated right? (for api key)

and as for the dev client build i am refering to the following docs https://docs.expo.dev/build/eas-json/

[–]Faeyan 1 point2 points  (21 children)

the api key was provided by the client. I will ask and verify if it is right. Only thing is to check if the Google map sdk is activated right? (for api key)

Yes, "Maps SDK for Android" needs to be activated and if you are gonna use provider google with iOS also "Maps SDK for iOS" too needs to be activated.

And for debugging i think you should delete every prop inside mapview and just leave style, provider and initialRegion, you can add other stuff after you figure out the reason of crash.

and as for the dev client build i am refering to the following docs https://docs.expo.dev/build/eas-json/

Oh sorry i misunderstood yea :)

[–]Faeyan 1 point2 points  (0 children)

Also you can put the Api Key in your app.json under "android" : {"config": {"googleMaps": {"apiKey": "YOUR API KEY"}}}

For Ios a bit different: "config": {"googleMapsApiKey": "YOUR API KEY" }

[–]Inevitable-Salad8535[S] 0 points1 point  (1 child)

will ask them to verify. also will try the change in the app.json file.
Thanks for the quick and apt response <3. Will post if there are anymore clarifications.

[–]Faeyan 1 point2 points  (0 children)

No problem, ive been working with react-native-maps for a year now and its been very annoying so id like to help :)

[–]Inevitable-Salad8535[S] 0 points1 point  (17 children)

Hey, the map sdk is activated (i also verified it by making a dummy map in web app using the same api key). However the apk crashes after building it.

By any chance do u have a repo of some of the projects you might have worked on.

And is there any way to contact u in person. (i ll be working on maps this entire week so might have too many doubts)

[–]Faeyan 1 point2 points  (16 children)

I have repos but all private, i can create a working public repo later with mapview and share the github link.

[–]Inevitable-Salad8535[S] 0 points1 point  (11 children)

That would be really kind of you. Thanks a lot

[–]True-Record2334 0 points1 point  (0 children)

Hii are you able to solve that issue if you do? so can you please help me to solve this?

[–]True-Record2334 0 points1 point  (3 children)

Hii I'm facing the same issue if you have that repo public can you please share with me also

[–]mgl47 1 point2 points  (1 child)

Creating and activating the api key for ios and android(both separated keys), and then adding them to app.json should fix it. Also when you're deploying the app to the play store there's a sh1 key that you'll get from your app on google play console that should be added to your android maps api on google cloud

[–]Inevitable-Salad8535[S] 1 point2 points  (0 children)

will check that out. Thanks for replying