[英]added Google API key still getting error API key not found
I did add google API key in meta data in my manifest file but still getting error "API key not found"我确实在清单文件的元数据中添加了 google API 密钥,但仍然出现错误“找不到 API 密钥”
<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!!!
请帮忙!!!
As per the documentation steps, you should add tag as aa 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
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.