API key not found

Viewed 10070

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.

3 Answers

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

Related