Android 地点 API:Google Play 服务在模拟器上已过时

Android Places API: Google Play Services Out of Date on Emulator

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

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

不幸的是,我只能在模拟器上进行测试,因为我没有物理设备。模拟器的图像是 API 级别 22 x86,目标是 Google API。此外,我试图通过 build.gradle 文件包含 Google 播放服务库:

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

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

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

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

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

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

完成此操作后,在您的(应用程序)中使用以下依赖项 build.gradle

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

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

我有同样的问题,现在我 "updated" 版本为 6774480 使缓存无效并重新启动,然后我 "downgraded" 依赖项 compile 'com.google.android.gms:play-services: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 获得了令牌并毫无问题地接收了下游推送消息。

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

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

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

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

我的 logcat 是

Google 播放服务已过时。需要 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'

有效