Google 在 Android 模拟器 4.2.2 或更高版本上播放服务。 "Google Maps API demos won't run unless you update Google Play Services"

Google Play Services on Android Emulator 4.2.2 or higher. "Google Maps API demos won't run unless you update Google Play Services"

以下是一些相关主题,但这些解决方案不起作用:

1.Running Google Maps v2 on the Android emulator

2.How to run Google Map API V2 on Android emulator

我什至遵循了 Google 开发人员关于此问题的文档。仍然没有。

To develop an app using the Google Play services APIs, you need to set up your project with the Google Play services SDK. If you haven't installed the Google Play services SDK yet, go get it now by following the guide to Adding SDK Packages.

To test your app when using the Google Play services SDK, you must use either:

  • A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
  • The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

我使用的模拟器 Android 5.1.1 高于 Android 4.2.2,但是当我 运行 地图示例代码时,我收到一条消息模拟器说:

"Google Maps API demos won't run unless you update Google Play Services"

它给了我一个更新选项,但是当我点击它时,我的模拟器屏幕上出现了这条消息:

"Unfortunatley, Google Maps API Demos has stopped"

任何人都可以阐明这个问题吗?我可以在真实设备上进行设置并进行测试,但我更愿意使用 android 模拟器,因为它快得多。

确保您使用 Google APIs (Google Inc.) 作为模拟器的目标。如果这不能解决问题,您可以 google 最新的 Google Play Services' apk 并在 adb install.

上安装它

=-=-=编辑=-=-=
API 22 级模拟器上的 Google Play 服务似乎存在错误。我为它提交了一个错误。
https://code.google.com/p/android/issues/detail?id=176348&thanks=176348&ts=1433887196

Google Play 服务在 API 21 和 API MNC

上似乎没问题

如果您的模拟器是在具有 Google Play 服务的 SDK 平台上构建的,并且您在尝试访问 Play 服务 API 时仍然遇到运行时错误......

删除模拟器,并在 SDK 管理器中卸载构建该模拟器的 SDK 平台。

然后,重新下载该 SDK 平台并重新构建您的模拟器。

为什么?

如果自从您下载了上述 SDK 平台并构建了该模拟器后 Google Play Services 有更新,则 Google Play Services 的旧版本可能仍在该 SDK 平台的构建中.

我发现获取最新版本 Play Services 的唯一方法是重新下载 SDK 平台并重新构建模拟器。