在您的应用程序的Andr​​oidManifest.xml中一个必需的元数据标签不存在。您的、不存在、应用程序、标签

2023-09-11 20:24:03 作者:掏心掏肺不如掏钱

我正在开发Android版谷歌地图应用程序。

I am developing a google maps app for android.

不过,不知我的应用程序崩溃给了一个错误,如:

But, somehow my application crashes giving an error like :

java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  

这是我的Andr​​oidManifest.xml的样子: -

This is what my AndroidManifest.xml looks like:-

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.locations"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>
  <permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>

  <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.locations.MainActivity"
            android:label="@string/app_name" >
            <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.maps.v2.API_KEY"
            android:value="AIzaSyAZhJllASbTnrFta8hj55shKydSi0ks824"/>

    </application>

</manifest>

日志: -

Log:-

01-09 12:29:35.249: E/AndroidRuntime(7448): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

我使用谷歌地图为这个应用程序 我该如何解决?

I am using google maps for this app How can i resolve this?

推荐答案

缺少下面的清单应用程序标签。这一保险业监督的新要求,因为更新的谷歌播放服务。

Missing the below in application tag of manifest. This ia new requirement as of updated google play services.

检查主题添加了谷歌播放服务版本的应用程序的清单@

Check the topic Add the Google Play services version to your app's manifest @

https://developers.google.com/maps/documentation/android/start

 <meta-data android:name="com.google.android.gms.version"
      android:value="@integer/google_play_services_version" />

删除此

<permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>

不需要