如何解决API 密钥不检查元数据是否反应原生
我第一次使用 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>
有人知道我错过了什么吗?
解决方法
<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”
并再次安装构建
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。