【问题标题】:API key is not check that metadata react nativeAPI 密钥不检查元数据是否反应原生
【发布时间】:2021-07-16 11:03:06
【问题描述】:

我第一次安装并正确配置它时使用react-native-maps,但是当我运行应用程序时显示以下错误:

API key not found. Chech that <Meta-data android:name:".." ...... is in the <application> element of AndroidManifest.xml

我尝试清理缓存,清理 gradlew,但没有解决我的问题。

AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.dateapp">

    <uses-permission android:name="android.permission.INTERNET" />

    <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:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize">
        <meta-data
     android:name="com.google.android.geo.xxxxxxxxxx"
     android:value="xxxxxxxxxx"/>
     
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>

有人知道我错过了什么吗?

【问题讨论】:

    标签: javascript reactjs react-native api-key react-native-maps


    【解决方案1】:
    <manifest 
      xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.dateapp">
    
       <uses-permission android:name="android.permission.INTERNET" />
    
    <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:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" 
        />
        </intent-filter>
      </activity>
       <meta-data
          android:name="com.google.android.geo.API_KEY"
          android:value="Your Google API Key Here"/>
      </application>
     </manifest>
    

    您不能更改 android:name 中的文字“API_KEY”,请将 android:name 设置为“com.google.android.geo.API_KEY”

    然后再次安装构建

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-14
      相关资源
      最近更新 更多