我收到一个提及添加元数据的例外,但即使添加后我仍然收到相同的异常。你能帮我解释一下我怎么能拒绝它吗?
01-08 20:22:05.380: E/AndroidRuntime(2335): Caused by: java.lang.IllegalStateException:
The meta-data tag in your app's AndroidManifest.xml does not have the right value.
Expected 4030500 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" />
在这里,你可以看到我的AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemapv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="17" />
<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"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<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"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.googlemapv2.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="AIzaSyColV0vSkdC8PmLLy4DiqiK-p-gXzUo-Ng"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
答案 0 :(得分:1)
试着把它改为。
<meta-data
android:name="com.google.android.gms.version"
android:value="4030500" />
如果这不起作用,请看一下。也许你有一个旧版本的GMS,或者没有正确链接到你的项目。