AndroidManifest.xml没有正确的值

时间:2015-04-19 15:24:31

标签: android

我试图在嵌套片段中显示GoogleMaps:

    // inflate and return the layout
    View v = inflater.inflate(R.layout.fragment_nearby_map, container, false);
    mMapView = (MapView) v.findViewById(R.id.mapView);

但我从某个例外情况中看到了一个似乎与播放服务版本有关的异常:Expected 7095000 but found 4323000

04-19 17:20:20.841  20612-20612/com.mahlzeit E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.mahlzeit, PID: 20612
    java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 7095000 but found 4323000.  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" />
            at com.google.android.gms.common.GooglePlayServicesUtil.zzJ(Unknown Source)
            at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
            at com.google.android.gms.maps.internal.zzx.zzad(Unknown Source)

由于version.xml文件确实包含值7095000,我不知道自己要做什么:

version.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="google_play_services_version">7095000</integer>
</resources>

的AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_app"
    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="@string/google_maps_key" />

    <activity> <!-- ... -->

3 个答案:

答案 0 :(得分:3)

尝试清理项目并重建

答案 1 :(得分:2)

也许你不需要自己的:

  

<integer name="google_play_services_version">7095000</integer>

并且应该使用库中提供的那个。请尝试删除此条目。

答案 2 :(得分:0)

尝试查找是否有任何其他'version.xml'文件可用且在该文件中将4323000(错误得到的值)替换为7095000(错误的值)。