android – 元数据标记没有正确的值

android – 元数据标记没有正确的值,第1张

概述我是 android的新手,我试图在我的应用程序中使用谷歌地图使用谷歌播放服务获取错误. MapViewActivty: public class MapsViewActivity extends FragmentActivity {// Google Mapprivate GoogleMap googleMap;@Overrideprotected void onCreate(Bund 我是 android的新手,我试图在我的应用程序中使用谷歌地图使用谷歌播放服务获取错误.

MapVIEwActivty:

public class MapsVIEwActivity extends FragmentActivity {// Google Mapprivate GoogleMap GoogleMap;@OverrIDeprotected voID onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentVIEw(R.layout.maps);    try {        // Loading map        initilizeMap();    } catch (Exception e) {        e.printstacktrace();    }}/** * function to load map. If map is not created it will create it for you * */private voID initilizeMap() {    if (GoogleMap == null) {        GoogleMap = ((MapFragment) getFragmentManager().findFragmentByID(                R.ID.map)).getMap();        // check if map is created successfully or not        if (GoogleMap == null) {            Toast.makeText(getApplicationContext(),"Sorry! unable to create maps",Toast.LENGTH_SHORT)                    .show();        }    }

maps.xml:

<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:layout_wIDth="fill_parent"androID:layout_height="fill_parent" ><fragment    androID:ID="@+ID/map"    androID:name="com.Google.androID.gms.maps.SupportMapFragment"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent" />

manifest.xml文件:

<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"package="com.example.careandcure"androID:versionCode="1"androID:versionname="1.0" ><uses-sdk    androID:minSdkVersion="8"    androID:targetSdkVersion="18" /><permission    androID:name="com.example.careandcure.permission.MAPS_RECEIVE"    androID:protectionLevel="signature" /><uses-permission androID:name="com.example.careandcure.permission.MAPS_RECEIVE" /><uses-permission androID:name="androID.permission.ACCESS_FINE_LOCATION" /><uses-permission androID:name="androID.permission.ACCESS_MOCK_LOCATION" /><uses-permission androID:name="androID.permission.ACCESS_COARSE_LOCATION" /><uses-permission androID:name="androID.permission.INTERNET" /><uses-permission androID:name="androID.permission.ACCESS_NETWORK_STATE" /><uses-permission androID:name="androID.permission.WRITE_EXTERNAL_STORAGE" /><uses-feature    androID:glEsversion="0x00020000"    androID:required="true" /><application    androID:allowBackup="true"    androID:icon="@drawable/logo"    androID:label="@string/app_name"    androID:theme="@style/Apptheme" >    <activity        androID:name="com.example.careandcure.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>    <activity androID:name="com.example.careandcure.MapsVIEwActivity" >    </activity>    <activity        androID:name="com.example.careandcure.MySearchAbleActivity"        androID:launchMode="singletop" >        <intent-filter>            <action androID:name="androID.intent.action.SEARCH" />        </intent-filter>        <Meta-data            androID:name="com.Google.androID.gms.version"            androID:value="@integer/Google_play_services_version" />        <Meta-data            androID:name="com.Google.androID.maps.v2.API_KEY"            androID:value="AIzaSyBOhdOOMI_ZMYlvSyi7DVeRe_bo9ckxehM" />        <Meta-data            androID:name="androID.app.searchable"            androID:resource="@layout/searchable" />    </activity>    <!-- declare the default searchable Activity for the whole app -->    <Meta-data        androID:name="androID.app.default_searchable"        androID:value=".MySearchAbleActivity" /> </application> </manifest>

并收到以下错误:

08-06 11:34:28.256: E/AndroIDRuntime(5932): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.careandcure/com.example.careandcure.MapsVIEwActivity}: androID.vIEw.InflateException: Binary XML file line #6: Error inflating class fragment08-06 11:34:28.256: E/AndroIDRuntime(5932): Caused by: androID.vIEw.InflateException: Binary XML file line #6: Error inflating class fragment08-06 11:34:28.256: E/AndroIDRuntime(5932):     at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:697)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.example.careandcure.MapsVIEwActivity.onCreate(MapsVIEwActivity.java:17)08-06 11:34:28.256: E/AndroIDRuntime(5932): Caused by: java.lang.IllegalStateException: The Meta-data tag in your app's AndroIDManifest.xml does not have the right value.  Expected 5089000 but found 0.  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" />08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.common.GooglePlayServicesUtil.A(UnkNown Source)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(UnkNown Source)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.maps.internal.u.I(UnkNown Source)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.maps.internal.u.H(UnkNown Source)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.maps.MapsInitializer.initialize(UnkNown Source)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.maps.SupportMapFragment$b.a(UnkNown Source)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.dynamic.a.a(UnkNown Source)08-06 11:34:28.256: E/AndroIDRuntime(5932):     at com.Google.androID.gms.dynamic.a.onInflate(UnkNown Source)

我没有得到我错在哪里或遗失任何东西以及如何删除请帮助我解决这个问题.提前致谢.

解决方法 您的元数据标签位于<活性GT;标签.删除并将其放在应用程序标记之后:
<applicationandroID:allowBackup="true"androID:icon="@drawable/logo"androID:label="@string/app_name"androID:theme="@style/Apptheme" >    <Meta-data        androID:name="com.Google.androID.gms.version"        androID:value="@integer/Google_play_services_version" />    <Meta-data        androID:name="com.Google.androID.maps.v2.API_KEY"        androID:value="AIzaSyBOhdOOMI_ZMYlvSyi7DVeRe_bo9ckxehM" />    <Meta-data        androID:name="androID.app.searchable"        androID:resource="@layout/searchable" /><activity>//not activity Tags
总结

以上是内存溢出为你收集整理的android – 元数据标记没有正确的值全部内容,希望文章能够帮你解决android – 元数据标记没有正确的值所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1134824.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存