模拟器中缺少 Google Play 服务(Android 4.4.2)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22141043/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:33:02  来源:igfitidea点击:

Google Play Services Missing in Emulator (Android 4.4.2)

androidemulationgoogle-play-services

提问by user1406716

For the emulator I have below, I am getting the error message that "Google Play Services not installed on the device".

对于下面的模拟器,我收到错误消息“设备上未安装 Google Play 服务”。

As per the developer site, it says that 'The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

根据开发人员站点,它说“带有 AVD 的 Android 模拟器运行基于 Android 4.2.2 或更高版本的 Google API 平台

Not able to understand if the emulator is running 4.4.2 then why is google play services not present?

无法理解模拟器是否正在运行 4.4.2 那么为什么 google play 服务不存在?

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

Some related threads, but no resolution. (adding these just to point out this issue is not a duplicate): Related ThreadRelated Thread

一些相关的线程,但没有解决。(添加这些只是为了指出这个问题不是重复的): 相关线程相关线程

采纳答案by Raghunandan

http://developer.android.com/google/play-services/setup.html

http://developer.android.com/google/play-services/setup.html

Quoting docs

引用文档

If you want to test your app on the emulator, expand the directory for Android 4.2.2 (API 17) or a higher version, select Google APIs, and install it. Then create a new AVD with Google APIs as the platform target.

如果您想在模拟器上测试您的应用程序,请展开 Android 4.2.2 (API 17) 或更高版本的目录,选择 Google APIs 并安装它。然后使用 Google API 作为平台目标创建一个新的 AVD。

Needs Emulator of Google API"S

需要 Google API"S 模拟器

See the target in the snap

查看快照中的目标

Snap

折断

enter image description here

在此处输入图片说明

I prefer testing on a real device which has google play services installed

我更喜欢在安装了 google play 服务的真实设备上进行测试

回答by CoolMonster

You will not able to test the app using the Google-Play-Service libraryin emulator. In order to test that app in emulator you need to install some system framework in your emulator to make it work.

您将无法使用Google-Play-Service libraryin 模拟器测试应用程序。为了在模拟器中测试该应用程序,您需要在模拟器中安装一些系统框架以使其工作。

https://stackoverflow.com/a/11213598/1405008

https://stackoverflow.com/a/11213598/1405008

Refer the above answer to install Google play service on your emulator.

请参阅上述答案以在您的模拟器上安装 Google Play 服务。

回答by Karl Morrison

If you happen to not have the image, download it via the SDK manager:

如果您碰巧没有图像,请通过 SDK 管理器下载:

enter image description here

在此处输入图片说明

回答by Demitrian

If you're using Xamarin, I found a guide on their official forumexplaining how to do this:

如果您使用的是 Xamarin,我在他们的官方论坛上找到了一个指南,解释了如何执行此操作:

  1. Download the package from the internet. There are many sources for this, one possible source is the CyanogenMod web site.
  2. Start up the Android Player and unlock it.
  3. Drag and drop the zip file that you downloaded onto the Android Player.
  4. Restart the Android Player.
  1. 从互联网下载软件包。这有很多来源,一个可能的来源是 CyanogenMod 网站
  2. 启动 Android Player 并解锁。
  3. 将您下载的 zip 文件拖放到 Android 播放器上。
  4. 重启安卓播放器。

Hereafter, you might also need to update the Google Play Services from the Google Play Store.

此后,您可能还需要从 Google Play 商店更新 Google Play 服务。

Hope this helps for anyone else who has troubles finding the documentation.

希望这对在查找文档时遇到困难的其他人有所帮助。

回答by Pandiarajan

Setp 1 : Download the following apk files. 1)com.google.android.gms.apk (https://androidfilehost.com/?fid=95916177934534438) 2)com.android.vending-4.4.22.apk (https://androidfilehost.com/?fid=23203820527945795)

第 1 步:下载以下 apk 文件。1)com.google.android.gms.apk ( https://androidfilehost.com/?fid=95916177934534438) 2)com.android.vending-4.4.22.apk ( https://androidfilehost.com/?fid= 23203820527945795)

Step 2 : Create a new AVD without the google API's

第 2 步:创建一个没有 google API 的新 AVD

Step 3 : Run the AVD (Start the emulator)

第 3 步:运行 AVD(启动模拟器)

Step 4 : Install the downloaded apks using adb .

第 4 步:使用 adb 安装下载的 apk。

     1)adb install com.google.android.gms-6.7.76_\(1745988-038\)-6776038-minAPI9.apk  
     2)adb install com.android.vending-4.4.22.apk

adb come up with android sdks/studio

adb 想出 android sdks/studio

Step 5 : Create the application in google developer console

第 5 步:在 google 开发者控制台中创建应用程序

Step 6 : Configure the api key in your Androidmanifest.xml and google api version.

第 6 步:在您的 Androidmanifest.xml 和 google api 版本中配置 api 密钥。

Note : In step1 you need to download the apk based on your Android API level(..18,19,21..) and google play services version (5,5.1,6,6.5......)

注意:在步骤1中,您需要根据您的Android API级别(..18,19,21..)和google play服务版本(5,5.1,6,6.5......)下载apk

This will work 100%.

这将 100% 工作。

回答by Waqar Ahmed

google play service is just a library to create application but in order to use application that use google play service library , you need to install google play in your emulator.and for that it need the unique device id. and device id is only on the real device not have on emulator. so for testing it , you need real android device.

谷歌播放服务只是一个创建应用程序的库,但为了使用使用谷歌播放服务库的应用程序,你需要在你的模拟器中安装谷歌播放。为此它需要唯一的设备ID。并且设备 id 仅在真实设备上没有在模拟器上。所以为了测试它,你需要真正的安卓设备。