【问题标题】:Android Places API: Google Play Services Out of Date on EmulatorAndroid Places API:模拟器上的 Google Play 服务已过期
【发布时间】:2015-04-13 04:42:38
【问题描述】:

我正在尝试在我的 Android 应用中使用 Google Places API 的 PlacePicker。但是,每当我尝试创建选择器时,都会收到以下错误消息:

Google Play services out of date. Requires 7095000 but found 6774470

不幸的是,因为我没有物理设备,所以我必须在模拟器上进行测试。模拟器的映像是 API 级别 22 x86,具有 Google API 目标。此外,我还尝试通过 build.gradle 文件包含 Google Play Services 库:

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

另外,我在 SDK 管理器中更新了 Google Play 服务。我究竟做错了什么?如何更新我的 Google Play 服务以便使用 Places API?

【问题讨论】:

标签: android android-emulator google-play-services google-places-api


【解决方案1】:

我遇到了同样的问题,不得不使用谷歌应用程序向下移动到 API 21 模拟器图像。那个是最新的,并且有效。

【讨论】:

  • 所以是模拟器问题?这不会在真实设备上发生?
  • @Igor Ganapolsky 当用户不更新他的 Google Play 服务时可能会发生这种情况,但由用户来解决该问题。
【解决方案2】:

如果 SDK 管理器显示您已经安装了最新版本,您可以简单地复制您的模拟器定义。

复制的模拟器将加载最新版本的 SDK。

【讨论】:

  • 好吧,对于 android,还有一件烦人的 AF 事情要处理!
【解决方案3】:

当我在 android wear 上使用 Google-Play-services 时遇到了类似的问题,然后我通过更新我的 android wear 应用程序版本来解决它。 (因为较新的 android wear 版本包含较新的 Google-Play-services)

此问题是由于您设备上的 Google-Play-services 版本太旧,您应该更新您设备上的 Google-Play-services 版本。

对于模拟器,您需要更新模拟器上的 Google-Play-services 而不是更新 SDK

【讨论】:

  • 你如何在你的模拟器上更新它?我在模拟器中找不到 Play 商店。
  • 您可能需要使用较新版本的 AVD(Android Virtual Device) 目标。
【解决方案4】:

我遇到了同样的问题,现在我将版本“更新”为 6774480,使缓存无效并重新启动,然后我“降级”了依赖项compile 'com.google.android.gms:play-services:6+' 它有效,我知道这不是一个真正的解决方案,但它是一种不好的方法,因此我可以测试我的应用程序

【讨论】:

    【解决方案5】:

    正如其他人所说,原因很可能是 AVD 中安装的 Google Play 不符合依赖要求。除了其他人建议的解决方案外,我尝试将所需的Google Play版本从8.3降低到8.1,问题就解决了。

    【讨论】:

      【解决方案6】:

      我只在 API 22 模拟器上遇到过这个问题。 21 和 23 都很好,我对物理设备没有任何问题。

      我很想知道这个低版本是否对 GCM 至关重要,因此修改了代码以继续进行:

      if (checkPlayServices()) {
                    // Start IntentService to register this application with GCM.
                    Intent intent = new Intent(this, ImpatientRegistrationIntentService.class);
                    startService(intent);
      } else {<<--   Added this as a bypass as my emulator complained about versions
                    Intent intent = new Intent(this, ImpatientRegistrationIntentService.class);
                    startService(intent);
      }
      

      有趣的是,API 22 模拟器从 GCM 获得了一个令牌,并且没有任何问题地接收到下游推送消息。

      【讨论】:

        【解决方案7】:

        这是我想出的解决方法,因为这里的解决方案都不适合我。此外,我不想更新我的代码以使用旧版本的播放服务。我最终使用 google play 而不是 google apis 安装了模拟器,然后当提示出现时,我只需单击更新。这将带你到谷歌游戏商店,你所要做的就是从那里更新游戏服务。唯一需要注意的是,此方法要求您使用 google 帐户登录模拟器。但是对于我的用例来说已经足够了。

        【讨论】:

        • 这张截图来自哪个屏幕?
        【解决方案8】:

        我的logcat是

        Google Play 服务已过期。需要 12210000 但找到 11947270

        所以我更改了 build.gradle 的代码

        implementation 'com.google.android.gms:play-services-maps:12.0.0'
        

        implementation 'com.google.android.gms:play-services-maps:11.0.0'
        

        它可以工作

        【讨论】:

          【解决方案9】:

          Tools > Android > SDK Manager 中更新您的包,然后检查 Extras 中所有有可用更新的包。

          完成此操作后,在 (app) build.gradle 中使用以下依赖项

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

          【讨论】:

          • 这不控制模拟器上安装的播放服务版本。
          • @IgorGanapolsky 那它有什么作用呢?
          • @gotnull 表示如果模拟器没有安装最新版本的Play Services,则无能为力。
          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2013-07-14
          • 1970-01-01
          • 1970-01-01
          • 2013-07-18
          • 2015-08-02
          • 2015-08-14
          • 2015-08-26
          相关资源
          最近更新 更多