Reputation: 605
I did add google API key in meta data in my manifest file but still getting error "API key not found"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abit">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<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"
>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data
android:name="com.google.android.geo.AIzaSyDPUc0RSV5OZzACrJcFPuBpxUHi0000000"
android:value="AIzaSyDPUc0RSV5OZzACrJcFPuBpxUHi0000000" />
</application>
I don't know where it is going wrong. Please help!!!
Upvotes: 0
Views: 57
Reputation: 897
As per the documentation steps, you should add tag as a a child of application tag, the meta data should look like:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY"/>
So, as per this your code should be:
<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"
>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data android:name="android:name="com.google.android.geo.API_KEY""
android:value="AIzaSyDPUc0RSV5OZzACrJcFPuBpxUHi0000000" />
</application>
Point to Note: You are passing the value for android:name
as com.google.android.geo.AIzaSyDPUc0RSV5OZzACrJcFPuBpxUHi0000000
instead of com.google.android.geo.API_KEY
Upvotes: 1