React-native-maps Blank page Only google logo
Can you provide some stack traces so that we can have a better insight on your problem? Your problem description sounds like your phone is not connected to the internet and this is why map is not rendered.
Regardless, here's some tips to get react-native-maps
running based on my past experiences.
- First and foremost, always configure your Android app according to the official documentation here.
- Make sure a Google Maps API key is generated through the console.
- Check whether your
react-native-maps
is compatible with yourreact-native
version. - Check your android build-tools version.
- If you are using the android emulator from Genymotion (older version), make sure you include Google Play Services, otherwise Map will not work.
- Active internet connection. Make sure your phone or emulator is connected for the Map to load (iOS is good without internet access).
- Always inject a
latlong
object to theinitialRegion
prop so that the map knows where to focus on.
I spent a whole day on trying solutions provided in google, but it seemed that legacy meta-data wasn't working for me, so I changed the line below in AndroidManifest.xml
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Your Google maps API Key Here"/>
to
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Your Google maps API Key Here"/>
and finally the map showed up.
Of course the Maps SDK for Android
must be enabled in Google Api Console. Here are the steps to enable Maps SDK for Android
for beginners:
Go to the Google Api Console.
on the top-left of the screen, just on the right side of
Google Apis
logo, you see your project name, select the right project name and then, below the project name, you see a blue text+ ENABLE APIS AND SERVICES
. Click on it.in the webpage that opens, scroll down to find
Maps SDK for Android
. Click to enable it.
Make sure you enable the API Key in Google Console to work with Maps SDK for Android
and if you want for iOS enable Maps SDK for iOS