您应用的 AndroidManifest.xml 中所需的元数据标记不存在。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21014222/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A required meta-data tag in your app's AndroidManifest.xml does not exist.
提问by user3146095
I am developing a google maps app for android.
我正在为 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.
This is what my AndroidManifest.xml looks like:-
这是我的 AndroidManifest.xml 的样子:-
<?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?
我正在为这个应用程序使用谷歌地图 我该如何解决这个问题?
回答by Raghunandan
Missing the below in application tag of manifest. This ia new requirement as of updated google play services.
清单的应用程序标签中缺少以下内容。这是更新的 google play 服务的新要求。
Check the topic Add the Google Play services version to your app's manifest @
检查主题将 Google Play 服务版本添加到您的应用程序清单 @
https://developers.google.com/maps/documentation/android/start
https://developers.google.com/maps/documentation/android/start
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Remove this
删除这个
<permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
not required
不需要
回答by Satyaki Mukherjee
Google Map V2 add new feature in AndroidManifest.xml. You will need to add this metatag within application
tag
Google Map V2 在 AndroidManifest.xml 中添加了新功能。您需要在application
标签中添加此元标签
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
回答by Jitesh Upadhyay
The Google Maps getting started https://developers.google.com/maps/documentation/android/start
Google 地图入门 https://developers.google.com/maps/documentation/android/start
guide says:
指南说:
Add the Google Play services version to your app's manifest
将 Google Play 服务版本添加到您的应用清单
Edit your application's AndroidManifest.xml file, and add the following declaration within the element. This embeds the version of Google Play services that the app was compiled with.
编辑应用程序的 AndroidManifest.xml 文件,并在元素中添加以下声明。这嵌入了编译应用程序的 Google Play 服务版本。
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
回答by Thirumoorthy
Try to add following meta-data tag on Manifest file it's working fine.
尝试在 Manifest 文件上添加以下元数据标签,它工作正常。
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
回答by Rupesh Yadav
As Google Map V2use use Google Play servicesyou need to keep it updated.
Latest google play services requires a version
name, which is to be mentioned using <meta-data .. />
inside AndroidManifest.xml
. This can be solved by both of the below ways_
由于Google Map V2使用Google Play 服务,您需要保持更新。最新的 google play 服务需要一个version
名称,要使用<meta-data .. />
inside来提及AndroidManifest.xml
。这可以通过以下两种方式解决_
1.Add following meta-data
inside application tag of your AndroidManifest.xml
1.meta-data
在您的应用程序标签中添加以下内容AndroidManifest.xml
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
this value is there in your Google Play services
library(res -> values -> version.xml)
这个值在你的Google Play services
库中(res -> values -> version.xml)
2.Directly add the version code like
2.直接添加版本代码如
<meta-data android:name="com.google.android.gms.version" android:value="4030500" />
4030500 is version code which is stored inside
4030500 是存储在里面的版本代码
google-play-services_lib>res>values>version.xml
google-play-services_lib>res>values>version.xml
Like
喜欢
<integer name="google_play_services_version">4030500</integer>
回答by Ozan Atmar
Try cleaning your project (select project>project tab>clean)
尝试清理您的项目(选择项目>项目选项卡>清理)
I solved my problem with this. Cleaning is the solution for most problems.
我用这个解决了我的问题。清洁是大多数问题的解决方案。
回答by Taps
There is no need for permission:
不需要许可:
<permission android:name="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
A tag including the google services might do the trick.
包含谷歌服务的标签可能会起作用。
回答by sagits
If you updateyour google play servicesyou need to update your res/values tagtoo.
如果您更新您的google play 服务,您也需要更新您的 res/values 标签。
回答by Muhammad Umair Moosani
you have to add this line
你必须添加这一行
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
in AndroidManifest.xml <application>