API 未找到密钥

API key not found

我正在尝试 React Native Maps,但当我这样做时得到了这个 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

我的 meta-data 标签来自 AndroidManifest.xml:

<meta-data
android:name="com.google.android.geo.maptest"
android:value="A***Q"
/>

我试过重新启动打包程序。

解决方案:android:name="com.google.android.geo.API_KEY" 是字面意思,不应更改。

在您的 AndroidManifest.xml 文件中添加以下内容:-

<meta-data
      android:name="com.google.android.geo.API_KEY"
      android:value="Your Google maps API Key Here"/>

然后 运行 react-native 运行-android 再次,你很高兴:)

编辑

您无法更改 android:name 中的文字 "API_KEY",请将 android:name 设置为 "com.google.android.geo.API_KEY"

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

在 AndroidManifest.xml 中,添加以下元素作为应用程序的子元素: 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......

然后重建应用程序,这将解决问题。 Snapshot of AndroidManifest.xml