谷歌地图V2不起作用

时间:2014-05-01 13:48:14

标签: android google-maps google-api

这里的任何人,谁知道,为什么这不起作用?:

清单:

<meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="MyAPIKey" />
</application>

<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-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" />

在我的xml中实现:

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

我收到此错误:

Caused by: java.lang.IllegalStateException: The meta-data tag in your app's     
AndroidManifest.xml does not have the right value.  Expected 4323000 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" />

我的清单中有元数据,但我收到了错误。为什么呢?

非常感谢:)

2 个答案:

答案 0 :(得分:2)

在清单文件中添加此内容 -

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

答案 1 :(得分:0)

你的logcat本身清楚地说:

您必须在申请元素中包含以下声明:

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