I want to use Google Play Services API in my application, but when I open the emulator to test my application it sends me a message that says "Google Play Services must be downloaded". I know that occurs because I coded this test in my MainActivity
in the method onResume()
.
I want to know how I can install Google Play Services in my emulator, because soon I will need to test my maps.
我想在我的应用程序中使用谷歌Play Services API,但是当我打开模拟器来测试我的应用程序时,它会向我发送一条消息,说“必须下载谷歌Play服务”。我知道会发生这种情况,因为我在我的主活动onResume()方法中编写了这个测试。我想知道如何在模拟器中安装谷歌播放服务,因为很快我就需要测试我的地图。
12 个解决方案
#1
73
Check out Setting Up Google Play Services which says:
查看设置谷歌播放服务,其中说:
To develop an app using the Google Play services APIs, you need to set up your project with the Google Play services SDK.
要开发一个使用谷歌游戏服务api的应用程序,您需要使用谷歌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.
如果您还没有安装谷歌Play services SDK,那么现在就通过添加SDK包的指南来获得它。
To test your app when using the Google Play services SDK, you must use either:
要在使用谷歌Play services SDK时测试您的应用程序,您必须使用:
- A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
- 一个兼容的Android设备,运行Android 2.3或更高版本,包括谷歌游戏商店。
- 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或更高版本的谷歌api平台。
#2
23
Now even better solution exist: using AVD image with build-in Google Play Services. It will enable you to use Google Services including Google Play. Also you will be able update it without re-creating AVD image.
现在还有更好的解决方案:使用AVD映像和内置的谷歌播放服务。它将使您能够使用谷歌服务,包括谷歌Play。你也可以在不重新创建AVD图像的情况下更新它。
Open AVD manager and choose create new device. You should use device definition with play store icon.
打开AVD管理器并选择创建新设备。您应该使用带有play store图标的设备定义。
Then choose system image for it. You should choose one with Google Play and NOT with Google API.
然后选择系统镜像。您应该选择使用谷歌播放而不是使用谷歌API。
Then launch new device.
然后推出新设备。
You can update Play Services as shown on screenshot, or manually on device..
您可以更新Play服务,如屏幕截图所示,或者手动更新设备。
#3
17
This is how you make Android Google Maps API v2 work on your emulator.
这就是如何让Android谷歌Maps API v2在模拟器上工作的方法。
Create a new emulator
创建一个新的模拟器
- for device choose "5.1'' WVGA (480 x 800: mdpi)"
- 设备选择"5.1 " WVGA (480 x 800: mdpi)"
- for target choose "Android 4.1.2 - API level 16"
- 目标选择“Android 4.1.2 - API级别16”
- for "CPU/ABI" choose "ARM"
- 对于“CPU / ABI”选择“手臂”
- leave rest to defaults
- 将剩下的缺省值
these are the settings that are working for me. I don't know for different ones.
这些都是对我有用的设置。我不知道有什么不同的。
Start the emulator
启动模拟器
install com.android.vending-1.apk and com.google.android.gms-1.apk via ADB install command
安装com.android.vending-1。apk com.google.android.gms-1。apk通过ADB安装命令
The longer answer is on my blog post about this issue http://nemanjakovacevic.net/blog/2012/12/how-to-make-android-google-maps-v2-work-in-android-emulator/
更长的答案在我关于这个问题的博客上:http://nemanjakovacou.net/blog2/12/howto -make android-google-maps-v2-work in- androidemulator/
#4
6
I came across another solution to use the Google play services on an emulator. The guys at http://www.genymotion.com/ provide very fast emulators on which you can install Google play services. They just need you to sign up to begin downloading and you need Virtual box installed. At the moment they cater for Android 16 and 17 but more are on the way.
我遇到了另一个在模拟器上使用谷歌play服务的解决方案。来自http://www.genymotion.com/的人提供了非常快速的仿真器,您可以在上面安装谷歌播放服务。他们只需要你注册开始下载,你需要安装虚拟框。目前,他们正在为Android 16和17提供服务,但更多的还在路上。
#5
3
In the current version (Android Studio 0.5.2) there is now a device type for "Google APIs x86 (Google Inc.) - API Level 19".
在当前版本(Android Studio 0.5.2)中,现在有一个用于“谷歌API x86(谷歌Inc.) - API级别19”的设备类型。
#6
3
The key is to select the target of your emulator to, for example: Google APIs (ver 18). If you select, for example, just Jellybean 18 (without API) you will not be able to test apps that require Google services such as map. Keep in mind that you must first download the Google API of your favorite version with the Android SDK Manager.
关键是选择模拟器的目标,例如:谷歌api (ver18)。例如,如果您选择Jellybean 18(没有API),您将无法测试需要谷歌服务(如map)的应用程序。请记住,您必须首先使用Android SDK管理器下载您最喜欢的版本的谷歌API。
This is a good practice and it is far better than juggling with most workarounds.
这是一个很好的练习,比应付大多数变通方法要好得多。
#7
2
I tried to develop google MAP API V2 application recently and tried to run it through emulator but I everytime it showed me error "Google Play Servcies is not installed in this phone". From my perpective even I think google MAP API V2 doesn't work on emulator.
我最近尝试开发谷歌MAP API V2应用程序,并尝试通过仿真器运行它,但每次它显示错误时,我都会说“谷歌Play Servcies在这款手机中没有安装”。从我的期望来看,即使我认为谷歌MAP API V2在模拟器上不工作。
Solution
解决方案
Then I tried to run the same example on my Sony Experia you and again it showed me same error. Then I installed google play services on my mobile and amazingly it started working..:)))
然后我试着在我的Sony Experia you上运行同样的例子,它再次显示了同样的错误。然后我在我的手机上安装了谷歌播放服务,令人惊讶的是它开始工作了。
#8
2
I got it working by
我已经搞定了
- Installing the Google Play Services through the Android SDK Manager
- 通过Android SDK管理器安装谷歌播放服务
- Using a Galaxy Nexus Device (4.65", 720 x 1280: xhdpi)
- 使用Galaxy Nexus设备(4.65,720 x 1280: xhdpi)
- Targeting the Android 4.2.2 Google API Level 17
- 针对Android 4.2.2谷歌API级别17。
#9
2
Go to https://university.xamarin.com/resources/working-with-android-emulators . Scroll down to the "Installing Google Play Services" section. Step by step walk through there.
访问https://university.xamarin.com/resources/working-with-android-emulators。向下滚动到“安装谷歌播放服务”一节。一步一步地走过去。
Directly plagarized from xamarin here so I don't get dinged for linking and not including solution. Posting this as I found the hit in stack before I found the solution that worked across the board on the xamarin page.
直接从xamarin复制过来,这样我就不会因为链接和不包含解决方案而受到影响。在我找到xamarin页面上全面工作的解决方案之前,我在堆栈中找到了hit,然后发布了这篇文章。
- Start the Xamarin Android Player and run one of the supplied images, the following assumes you have started the KitKat Nexus 4 image. Download the proper Google Play Services .zip file from www.teamandroid.com/gapps/ . Make sure to download the image appropriate for your version of Android.
- 启动Xamarin Android播放器并运行其中一个提供的图像,以下假设您已经启动了KitKat Nexus 4图像。下载正确的谷歌播放服务。zip文件从www.teamandroid.com/gapps/。请务必下载适合您的Android版本的图片。
- Drag the .zip file onto the running emulator and drop it to install the component, here we show it on Mac OS X, but the same mechanism is used in Windows. You will get a prompt to install the package onto the emulator which indicates the image will be restarted
- 将.zip文件拖到正在运行的仿真器上,并将其删除以安装组件,这里我们在Mac OS X上展示了它,但是Windows中使用的机制是相同的。您将得到一个提示,将包安装到模拟器上,该模拟器指示映像将重新启动
- Once it restarts, you will get a notification that installation is completed, and the image will now have Google Maps, Google+ and support for the Google Play store. Note that some things do not work correctly and you may get a few errors from some of the services, but you can safely dismiss these and continue the instructions.
- 一旦它重新启动,您将得到安装完成的通知,映像现在将具有谷歌映射、谷歌+和对谷歌Play商店的支持。注意,有些东西不能正常工作,有些服务可能会出错,但是您可以安全地忽略这些错误并继续执行这些操作。
- Next, you will need to associate a Google account so that you can update the services using the Google Play store. It should prompt you for this, but if it does not, you can go into the Google Settings and add a new account. Once you've added the account, you can then update the Google apps by opening the Google Play store application and going into settings from the side bar menu.
- 接下来,需要关联谷歌帐户,以便使用谷歌Play商店更新服务。它应该提示您这样做,但是如果没有,您可以进入谷歌设置并添加一个新帐户。一旦您添加了帐户,您就可以通过打开谷歌Play store应用程序并从侧边栏菜单进入设置来更新谷歌应用程序。
- Select Settings and then scroll down to the Build Version number information and double-tap on it until it tells you it is either up-to-date, or that it will download and install a new version.
- 选择设置,然后向下滚动到构建版本号信息,双击它,直到它告诉你它不是最新的,或者它将下载并安装一个新版本。
- Power off the device (press and hold the power button in the toolbar on the right) and restart it. Once it restarts, it should indicate that it needs to update the Google Play services, tapping the notification will open the Google Play Store and install the latest version
- 关闭设备电源(按下右侧工具栏上的电源按钮)并重新启动。一旦它重新启动,它应该表明它需要更新谷歌播放服务,点击通知将打开谷歌播放存储并安装最新版本
Now you can run applications that depend on Google Maps in the Xamarin Android Player.
现在,您可以在Xamarin Android Player中运行依赖谷歌映射的应用程序。
#10
1
If your emulator x86 this method works your me.
如果您的仿真器x86,那么这个方法对您的me有效。
Download and install http://opengapps.org/app/opengapps-app-v16.apk. And select nano pack
下载并安装http://opengapps.org/app/opengapps-app-v16.apk。并选择纳米包
More info http://opengapps.org/app/
更多信息:http://opengapps.org/app/
#11
0
To the latest setup and information if you have installed the Android Studio (i.e. 1.5) and trying to target SDK 4.0 then you may not be able to locate and setup the and AVD Emulator with SDK-vX.XX (with Google API's).
对于最新的设置和信息,如果您安装了Android Studio(即1.5)并试图将SDK 4.0作为目标,那么您可能无法使用SDK- vx定位和设置和AVD模拟器。XX(Google的API)。
See following steps in order to download the required library and start with that. AVD Emulator setup -setting up Emulator for SDK4.0 with GoogleAPI so Map application can work- In Android Studio
请参阅以下步骤,以便下载所需的库并从该库开始。AVD仿真器的设置——使用GoogleAPI为SDK4.0设置仿真器,以便Map应用程序可以工作——在Android Studio中
But unfortunately above method did not work well on my side. And was not able to created Emulator with API Level 17 (SDK 4.2). So I followed this post that worked on my side well. The reason seems that the Android Studio Emulator creation window has limited options/features.
但不幸的是,上面的方法在我这边并不奏效。并且无法创建API级别17 (SDK 4.2)的仿真器。所以我遵循了这个在我这边很有效的帖子。原因似乎是Android Studio模拟器创建窗口的选项/功能有限。
Google Play Services in emulator, implementing Google Plus login button etc
谷歌在模拟器中播放服务,实现谷歌+登录按钮等
#12
0
I know this is an old question, but I got here because I had a similar problem as everyone above. I solved it by just reading a little closer!
我知道这是个老问题,但我来这里是因为我和上面的每个人都有类似的问题。我把它看得更近了!
I hadn't noticed there were 2 possible system Images I could choose from, one that contained Google APIs and one that didn't (on my laptop the menu was too small for me to read the (with Google APIs) text appended.
我没有注意到有两种可能的系统映像可供我选择,一种包含谷歌api,另一种不包含(在我的笔记本上,菜单太小了,我无法阅读(带有谷歌api)文本。
It's a stupid thing to miss, but someone else might have a small screen like I did, and miss this :D
这是一件很愚蠢的事情,但其他人可能有一个小屏幕,就像我一样,错过了这个:D
#1
73
Check out Setting Up Google Play Services which says:
查看设置谷歌播放服务,其中说:
To develop an app using the Google Play services APIs, you need to set up your project with the Google Play services SDK.
要开发一个使用谷歌游戏服务api的应用程序,您需要使用谷歌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.
如果您还没有安装谷歌Play services SDK,那么现在就通过添加SDK包的指南来获得它。
To test your app when using the Google Play services SDK, you must use either:
要在使用谷歌Play services SDK时测试您的应用程序,您必须使用:
- A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
- 一个兼容的Android设备,运行Android 2.3或更高版本,包括谷歌游戏商店。
- 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或更高版本的谷歌api平台。
#2
23
Now even better solution exist: using AVD image with build-in Google Play Services. It will enable you to use Google Services including Google Play. Also you will be able update it without re-creating AVD image.
现在还有更好的解决方案:使用AVD映像和内置的谷歌播放服务。它将使您能够使用谷歌服务,包括谷歌Play。你也可以在不重新创建AVD图像的情况下更新它。
Open AVD manager and choose create new device. You should use device definition with play store icon.
打开AVD管理器并选择创建新设备。您应该使用带有play store图标的设备定义。
Then choose system image for it. You should choose one with Google Play and NOT with Google API.
然后选择系统镜像。您应该选择使用谷歌播放而不是使用谷歌API。
Then launch new device.
然后推出新设备。
You can update Play Services as shown on screenshot, or manually on device..
您可以更新Play服务,如屏幕截图所示,或者手动更新设备。
#3
17
This is how you make Android Google Maps API v2 work on your emulator.
这就是如何让Android谷歌Maps API v2在模拟器上工作的方法。
Create a new emulator
创建一个新的模拟器
- for device choose "5.1'' WVGA (480 x 800: mdpi)"
- 设备选择"5.1 " WVGA (480 x 800: mdpi)"
- for target choose "Android 4.1.2 - API level 16"
- 目标选择“Android 4.1.2 - API级别16”
- for "CPU/ABI" choose "ARM"
- 对于“CPU / ABI”选择“手臂”
- leave rest to defaults
- 将剩下的缺省值
these are the settings that are working for me. I don't know for different ones.
这些都是对我有用的设置。我不知道有什么不同的。
Start the emulator
启动模拟器
install com.android.vending-1.apk and com.google.android.gms-1.apk via ADB install command
安装com.android.vending-1。apk com.google.android.gms-1。apk通过ADB安装命令
The longer answer is on my blog post about this issue http://nemanjakovacevic.net/blog/2012/12/how-to-make-android-google-maps-v2-work-in-android-emulator/
更长的答案在我关于这个问题的博客上:http://nemanjakovacou.net/blog2/12/howto -make android-google-maps-v2-work in- androidemulator/
#4
6
I came across another solution to use the Google play services on an emulator. The guys at http://www.genymotion.com/ provide very fast emulators on which you can install Google play services. They just need you to sign up to begin downloading and you need Virtual box installed. At the moment they cater for Android 16 and 17 but more are on the way.
我遇到了另一个在模拟器上使用谷歌play服务的解决方案。来自http://www.genymotion.com/的人提供了非常快速的仿真器,您可以在上面安装谷歌播放服务。他们只需要你注册开始下载,你需要安装虚拟框。目前,他们正在为Android 16和17提供服务,但更多的还在路上。
#5
3
In the current version (Android Studio 0.5.2) there is now a device type for "Google APIs x86 (Google Inc.) - API Level 19".
在当前版本(Android Studio 0.5.2)中,现在有一个用于“谷歌API x86(谷歌Inc.) - API级别19”的设备类型。
#6
3
The key is to select the target of your emulator to, for example: Google APIs (ver 18). If you select, for example, just Jellybean 18 (without API) you will not be able to test apps that require Google services such as map. Keep in mind that you must first download the Google API of your favorite version with the Android SDK Manager.
关键是选择模拟器的目标,例如:谷歌api (ver18)。例如,如果您选择Jellybean 18(没有API),您将无法测试需要谷歌服务(如map)的应用程序。请记住,您必须首先使用Android SDK管理器下载您最喜欢的版本的谷歌API。
This is a good practice and it is far better than juggling with most workarounds.
这是一个很好的练习,比应付大多数变通方法要好得多。
#7
2
I tried to develop google MAP API V2 application recently and tried to run it through emulator but I everytime it showed me error "Google Play Servcies is not installed in this phone". From my perpective even I think google MAP API V2 doesn't work on emulator.
我最近尝试开发谷歌MAP API V2应用程序,并尝试通过仿真器运行它,但每次它显示错误时,我都会说“谷歌Play Servcies在这款手机中没有安装”。从我的期望来看,即使我认为谷歌MAP API V2在模拟器上不工作。
Solution
解决方案
Then I tried to run the same example on my Sony Experia you and again it showed me same error. Then I installed google play services on my mobile and amazingly it started working..:)))
然后我试着在我的Sony Experia you上运行同样的例子,它再次显示了同样的错误。然后我在我的手机上安装了谷歌播放服务,令人惊讶的是它开始工作了。
#8
2
I got it working by
我已经搞定了
- Installing the Google Play Services through the Android SDK Manager
- 通过Android SDK管理器安装谷歌播放服务
- Using a Galaxy Nexus Device (4.65", 720 x 1280: xhdpi)
- 使用Galaxy Nexus设备(4.65,720 x 1280: xhdpi)
- Targeting the Android 4.2.2 Google API Level 17
- 针对Android 4.2.2谷歌API级别17。
#9
2
Go to https://university.xamarin.com/resources/working-with-android-emulators . Scroll down to the "Installing Google Play Services" section. Step by step walk through there.
访问https://university.xamarin.com/resources/working-with-android-emulators。向下滚动到“安装谷歌播放服务”一节。一步一步地走过去。
Directly plagarized from xamarin here so I don't get dinged for linking and not including solution. Posting this as I found the hit in stack before I found the solution that worked across the board on the xamarin page.
直接从xamarin复制过来,这样我就不会因为链接和不包含解决方案而受到影响。在我找到xamarin页面上全面工作的解决方案之前,我在堆栈中找到了hit,然后发布了这篇文章。
- Start the Xamarin Android Player and run one of the supplied images, the following assumes you have started the KitKat Nexus 4 image. Download the proper Google Play Services .zip file from www.teamandroid.com/gapps/ . Make sure to download the image appropriate for your version of Android.
- 启动Xamarin Android播放器并运行其中一个提供的图像,以下假设您已经启动了KitKat Nexus 4图像。下载正确的谷歌播放服务。zip文件从www.teamandroid.com/gapps/。请务必下载适合您的Android版本的图片。
- Drag the .zip file onto the running emulator and drop it to install the component, here we show it on Mac OS X, but the same mechanism is used in Windows. You will get a prompt to install the package onto the emulator which indicates the image will be restarted
- 将.zip文件拖到正在运行的仿真器上,并将其删除以安装组件,这里我们在Mac OS X上展示了它,但是Windows中使用的机制是相同的。您将得到一个提示,将包安装到模拟器上,该模拟器指示映像将重新启动
- Once it restarts, you will get a notification that installation is completed, and the image will now have Google Maps, Google+ and support for the Google Play store. Note that some things do not work correctly and you may get a few errors from some of the services, but you can safely dismiss these and continue the instructions.
- 一旦它重新启动,您将得到安装完成的通知,映像现在将具有谷歌映射、谷歌+和对谷歌Play商店的支持。注意,有些东西不能正常工作,有些服务可能会出错,但是您可以安全地忽略这些错误并继续执行这些操作。
- Next, you will need to associate a Google account so that you can update the services using the Google Play store. It should prompt you for this, but if it does not, you can go into the Google Settings and add a new account. Once you've added the account, you can then update the Google apps by opening the Google Play store application and going into settings from the side bar menu.
- 接下来,需要关联谷歌帐户,以便使用谷歌Play商店更新服务。它应该提示您这样做,但是如果没有,您可以进入谷歌设置并添加一个新帐户。一旦您添加了帐户,您就可以通过打开谷歌Play store应用程序并从侧边栏菜单进入设置来更新谷歌应用程序。
- Select Settings and then scroll down to the Build Version number information and double-tap on it until it tells you it is either up-to-date, or that it will download and install a new version.
- 选择设置,然后向下滚动到构建版本号信息,双击它,直到它告诉你它不是最新的,或者它将下载并安装一个新版本。
- Power off the device (press and hold the power button in the toolbar on the right) and restart it. Once it restarts, it should indicate that it needs to update the Google Play services, tapping the notification will open the Google Play Store and install the latest version
- 关闭设备电源(按下右侧工具栏上的电源按钮)并重新启动。一旦它重新启动,它应该表明它需要更新谷歌播放服务,点击通知将打开谷歌播放存储并安装最新版本
Now you can run applications that depend on Google Maps in the Xamarin Android Player.
现在,您可以在Xamarin Android Player中运行依赖谷歌映射的应用程序。
#10
1
If your emulator x86 this method works your me.
如果您的仿真器x86,那么这个方法对您的me有效。
Download and install http://opengapps.org/app/opengapps-app-v16.apk. And select nano pack
下载并安装http://opengapps.org/app/opengapps-app-v16.apk。并选择纳米包
More info http://opengapps.org/app/
更多信息:http://opengapps.org/app/
#11
0
To the latest setup and information if you have installed the Android Studio (i.e. 1.5) and trying to target SDK 4.0 then you may not be able to locate and setup the and AVD Emulator with SDK-vX.XX (with Google API's).
对于最新的设置和信息,如果您安装了Android Studio(即1.5)并试图将SDK 4.0作为目标,那么您可能无法使用SDK- vx定位和设置和AVD模拟器。XX(Google的API)。
See following steps in order to download the required library and start with that. AVD Emulator setup -setting up Emulator for SDK4.0 with GoogleAPI so Map application can work- In Android Studio
请参阅以下步骤,以便下载所需的库并从该库开始。AVD仿真器的设置——使用GoogleAPI为SDK4.0设置仿真器,以便Map应用程序可以工作——在Android Studio中
But unfortunately above method did not work well on my side. And was not able to created Emulator with API Level 17 (SDK 4.2). So I followed this post that worked on my side well. The reason seems that the Android Studio Emulator creation window has limited options/features.
但不幸的是,上面的方法在我这边并不奏效。并且无法创建API级别17 (SDK 4.2)的仿真器。所以我遵循了这个在我这边很有效的帖子。原因似乎是Android Studio模拟器创建窗口的选项/功能有限。
Google Play Services in emulator, implementing Google Plus login button etc
谷歌在模拟器中播放服务,实现谷歌+登录按钮等
#12
0
I know this is an old question, but I got here because I had a similar problem as everyone above. I solved it by just reading a little closer!
我知道这是个老问题,但我来这里是因为我和上面的每个人都有类似的问题。我把它看得更近了!
I hadn't noticed there were 2 possible system Images I could choose from, one that contained Google APIs and one that didn't (on my laptop the menu was too small for me to read the (with Google APIs) text appended.
我没有注意到有两种可能的系统映像可供我选择,一种包含谷歌api,另一种不包含(在我的笔记本上,菜单太小了,我无法阅读(带有谷歌api)文本。
It's a stupid thing to miss, but someone else might have a small screen like I did, and miss this :D
这是一件很愚蠢的事情,但其他人可能有一个小屏幕,就像我一样,错过了这个:D