Google Play 服务在 Android 模拟器中已过时

Google Play Services out of date in Android Emulator

我有一个带有 Marshmallow 和 Google Apis 的 android 模拟器。 由于某种原因,Google Play 服务卡在了 8.1.85 版中,并且没有得到更新。 我的应用程序在 Android Studio Gradle:

中使用 8.3 版本
compile 'com.google.android.gms:play-services:8.3.0'

应用程序启动时检测到它已过期,因此出现 "update dialog"。点击更新它什么都不做。我得到这个日志:

12-21 12:21:46.369 3516-3516/app.pack.com W/GooglePlayServicesUtil: Google Play services out of date.  Requires 8298000 but found 8185470
12-21 12:21:46.548 3516-3541/app.pack.com W/EGL_emulation: eglSurfaceAttrib not implemented
12-21 12:21:46.548 3516-3541/app.pack.com W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xabff10c0, error=EGL_SUCCESS
12-21 12:21:46.685 3516-3541/app.pack.com W/EGL_emulation: eglSurfaceAttrib not implemented
12-21 12:21:46.686 3516-3541/app.pack.com W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb3f09320, error=EGL_SUCCESS
12-21 12:21:47.065 3516-3541/app.pack.com W/EGL_emulation: eglSurfaceAttrib not implemented
12-21 12:21:47.065 3516-3541/app.pack.com W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb3f3f240, error=EGL_SUCCESS
12-21 12:21:50.302 3516-3541/app.pack.com E/Surface: getSlotFromBufferLocked: unknown buffer: 0xab7980b0
12-21 12:21:56.326 3516-3516/app.pack.com E/SettingsRedirect: Can't redirect to app settings for Google Play services
12-21 12:21:56.333 3516-3541/app.pack.com E/Surface: getSlotFromBufferLocked: unknown buffer: 0xab796d70
12-21 12:21:56.339 3516-3541/app.pack.com D/OpenGLRenderer: endAllStagingAnimators on 0xa19fa980 (RippleDrawable) with handle 0xb12c9ac0
12-21 12:21:56.366 3516-3516/app.pack.com W/GooglePlayServicesUtil: Google Play services out of date.  Requires 8298000 but found 8185470
12-21 12:21:56.432 3516-3541/app.pack.com W/EGL_emulation: eglSurfaceAttrib not implemented
12-21 12:21:56.432 3516-3541/app.pack.com W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad71b0c0, error=EGL_SUCCESS
12-21 12:21:56.793 3516-3541/app.pack.com W/EGL_emulation: eglSurfaceAttrib not implemented
12-21 12:21:56.793 3516-3541/app.pack.com W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb3f3f920, error=EGL_SUCCESS
12-21 12:22:00.027 3516-3541/app.pack.com E/Surface: getSlotFromBufferLocked: unknown buffer: 0xab798e40

这个问题我之前试过的解决办法是改成:

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

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

有时,gradle 中反映的不是实际版本,通过输入 +,应用程序将自动使用可用的最新版本。

这是解决方案:使用带有内置 Google Play 服务的 AVD 图像。它将使您能够使用 Google 服务,包括 Google Play。您也可以在不重新创建 AVD 图像的情况下更新它。

打开 AVD 管理器并选择创建新设备。您应该使用带有 Play 商店图标的设备定义。

然后为其选择系统镜像。你应该选择 Google PlayNOT 和 Google API.

然后启动新设备。

您可以如屏幕截图所示或在设备上手动更新 Play 服务..