添加了 Google API 密钥仍然收到错误 API 密钥未找到

我确实在清单文件的元数据中添加了 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>

我不知道哪里出了问题。请帮忙!!!


慕少森
浏览 128回答 1
1回答

慕码人8056858

根据文档步骤,您应该添加标签作为应用程序标签的子级,元数据应如下所示:<meta-data&nbsp; &nbsp; android:name="com.google.android.geo.API_KEY"&nbsp; &nbsp; android:value="YOUR_API_KEY"/>所以,根据这个你的代码应该是:<application&nbsp; android:name=".MainApplication"&nbsp; android:label="@string/app_name"&nbsp; android:icon="@mipmap/ic_launcher"&nbsp; android:roundIcon="@mipmap/ic_launcher_round"&nbsp; android:allowBackup="false"&nbsp; android:theme="@style/AppTheme"&nbsp;>&nbsp; &nbsp;&nbsp; <activity&nbsp; &nbsp; &nbsp;android:name=".MainActivity"&nbsp; &nbsp; android:label="@string/app_name"android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"&nbsp; &nbsp;android:launchMode="singleTask"&nbsp; &nbsp;android:windowSoftInputMode="adjustResize">&nbsp; &nbsp;<intent-filter>&nbsp; &nbsp; &nbsp;<action android:name="android.intent.action.MAIN" />&nbsp; &nbsp; &nbsp;<category android:name="android.intent.category.LAUNCHER" />&nbsp; &nbsp;</intent-filter>&nbsp;</activity>&nbsp;<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />&nbsp;<meta-data android:name="android:name="com.google.android.geo.API_KEY""&nbsp; android:value="AIzaSyDPUc0RSV5OZzACrJcFPuBpxUHi0000000" />&nbsp;</application>注意点:android:name您传递的是as的值com.google.android.geo.AIzaSyDPUc0RSV5OZzACrJcFPuBpxUHi0000000而不是com.google.android.geo.API_KEY
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript