Ray Lee
Ray Lee

Reputation: 319

API key not found

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.

Upvotes: 12

Views: 16733

Answers (3)

PrateekHIT
PrateekHIT

Reputation: 33

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

Upvotes: 3

Digvijay Machale
Digvijay Machale

Reputation: 599

In AndroidManifest.xml, add the following element as a child of the element, by inserting it just before the closing tag:

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="YOUR_API_KEY"/>

please click here for reference

Upvotes: 3

Akshay Rao
Akshay Rao

Reputation: 3544

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"

Upvotes: 22

Related Questions