The meta-data tag does not have right value

前端 未结 2 1742
伪装坚强ぢ
伪装坚强ぢ 2021-01-18 09:59

I am newer in android , I am trying to use Google Maps in my application using google play services getting errors.

MapViewActivty:

public class Maps         


        
相关标签:
2条回答
  • 2021-01-18 10:29

    Your logcat clearly said:

    idRuntime(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)
    

    You need to add Google Play Services Version as <meta-data> tag under <application> tag in your manifest.xml

     <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    
    0 讨论(0)
  • 2021-01-18 10:43

    Your metadata tag is inside the < activity> tag. Remove and place it right after the application tag:

    <application
    android: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
    
    0 讨论(0)
提交回复
热议问题