I'm trying out React Native Maps but get this when I do react-native run-android
:
API key not found. Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml
My meta-data
tag from AndroidManifest.xml:
<meta-data
android:name="com.google.android.geo.maptest"
android:value="A***Q"
/>
I have tried restarting the packager.
Solution: android:name="com.google.android.geo.API_KEY"
is literal and shouldn't be changed.
Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key.
The API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes. You must have at least one API key associated with your project. To create an API key: Console Cloud SDK.
There are a several reasons why your google maps may not be working, the most common issue being no Google Map API key set or set incorrectly. To use the Google Maps JavaScript API, you must register your app project on the Google Cloud Platform Console and get a Google API key which you can add to your app.
In your AndroidManifest.xml file add the following :-
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Your Google maps API Key Here"/>
and then run react-native run-android again and you are good to go :)
edit
You can't change the literal "API_KEY" in android:name, Set the android:name as "com.google.android.geo.API_KEY"
In AndroidManifest.xml, add the following element as a child of the application: AppName\android\app\src\main\AndroidManifest.xml:
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Your API Key Will be inserted here"/>
<activity......
Then rebuild the app and this will solve the problem. Snapshot of AndroidManifest.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With