android google play服务已过期

时间:2014-08-08 12:22:07

标签: android google-maps google-play-services

我正在尝试在我的活动中添加Google地图(我已经完成了),每当我继续活动时,我都会收到一条消息,说我需要更新我的Google Play服务(显然它们是)

此外,我使用的是真正的设备,我没有模仿任何东西。

这是我的AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.soueuls.swipe" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CAMERA" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />

    <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=".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=".AdministrationActivity"
            android:label="@string/title_activity_administration" >
        </activity>
        <activity
            android:name=".GroupActivity"
            android:label="@string/title_activity_group" >
        </activity>
        <activity
            android:name=".NewsActivity"
            android:label="@string/title_activity_news" >
        </activity>
        <activity
            android:name=".DiderotActivity"
            android:label="@string/title_activity_diderot" >
        </activity>
        <activity
            android:name=".MapActivity"
            android:label="@string/title_activity_map" >
        </activity>
        <activity
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.NoTitleBar"
            android:name=".CameraActivity"
            android:label="@string/title_activity_camera" >
        </activity>

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

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

</manifest>

这是我的活动的xml文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.example.soueuls.swipe.MapActivity">

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

</RelativeLayout>

这是我的活动档案:

package com.example.soueuls.swipe;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;

public class MapActivity extends ActionBarActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);

        GoogleMap map = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        BaseMenuHandler.onCreateOptionsMenu(menu, this);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        BaseMenuHandler.onOptionItemSelected(item, this);
        return super.onOptionsItemSelected(item);
    }
}

有什么想法吗?

1 个答案:

答案 0 :(得分:6)

我自己解决了这个问题。

似乎最新的“Google Play服务”虽然我的IDE不适合发布应用和使用API​​。我不得不在本地构建gradle文件中替换:

compile 'com.google.android.gms:play-services:+'

由:

compile 'com.google.android.gms:play-services:5.0.89'