使用Google Maps API“除非您更新Google Play服务,否则应用程序将无法运行" [英] “App won't run unless you update Google Play services” with Google Maps API

查看:82
本文介绍了使用Google Maps API“除非您更新Google Play服务,否则应用程序将无法运行"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google Maps API创建了一个应用.尝试解决错误几个小时后,我成功运行了它(没有崩溃).但是现在我得到一个错误.

I created an app with Google Maps API. After few hours of trying to resolve errors, I successfuly runned it(without crashes). But now I get a error.

该警报表示除非您更新Google Play服务,否则应用程序将无法运行".我听说模拟器有此错误,但我使用的是真实设备(姜饼上的LG P350).我有配备Android 2.3的设备,所以我使用SupportLibrary.

That alert means "App won't run unless you update Google Play services". I heard about that error with emulator, but I'm using real device(LG P350 on Gingerbread). I have got device with android 2.3 so I use SupportLibrary.

我的活动文件

<?xml version="1.0" encoding="utf-8"?>
<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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".Map" >

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

</RelativeLayout>

和AndroidManifest

And AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="io.secrop.where360"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />



        <permission
            android:name="io.secorp.where360.permission.MAPS_RECEIVE"
            android:protectionLevel="signature"/>
        <uses-permission android:name="io.secorp.where360.permission.MAPS_RECEIVE"/>    
        <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" >

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

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


        <activity
            android:name="io.secrop.where360.Map"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


    </application>

</manifest>

有什么想法吗?

推荐答案

您遇到了错误的时间点.

You have hit a wrong point in time.

Google Play服务最近已更新至4.0.30,因此您似乎正在使用该版本的google-play-services_lib.根据此行的假设:

Google Play Services have been updated to 4.0.30 very recently and so you seem to be using that version of google-play-services_lib. Assumption based on this line:

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

并非所有设备都收到了GooglePlayServices.APK的更新,该更新必须至少与您使用的客户端库的版本相同.

Not all devices have received an update of GooglePlayServices.APK, which needs to be at least the same version as a client library you are using.

在设置"应用中检查GPServices.APK的版本.对我来说,它仍然是3.2.66,上次我不得不等待几天以进行更新.

Check version of GPServices.APK in Settings app. For me it is still at 3.2.66 and last time I had to wait few days for the update.

如果使用gradle,则可以降低版本依赖性.如果没有,则必须从某个地方下载旧版本的google-play-services_lib.

If you are using gradle, you can put lower version dependency. If not, you have to download older version of google-play-services_lib from somewhere.

或从Android SDK获取Froyo的Google Play服务.与以前的版本(3.2.65)相同.

or get Google Play Services for Froyo from Android SDK. It is the same as previous release (3.2.65).

这篇关于使用Google Maps API“除非您更新Google Play服务,否则应用程序将无法运行"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆