谷歌播放服务的模拟器,实现谷歌加登录按钮等 [英] Google Play Services in emulator, implementing Google Plus login button etc

查看:220
本文介绍了谷歌播放服务的模拟器,实现谷歌加登录按钮等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在一个Android应用程序集成了谷歌加登录按钮,我观察了如何按钮出现在实际设备和仿真器的一些不同之处。我知道,谷歌加服务的APK没有安装在模拟器中的事实,但是这可以通过左右从设备拉动的APK并将它们安装到使用的APK仿真器进行工作。

When integrating a Google Plus login button in an Android app, I'm observing some differences in how the button appears on an actual device and in the emulator. I am aware of the fact that the Google Plus services APKs are not installed in the emulator, but this can be worked around by pulling the APKs from a device and installing them into the emulator using APK.

我目前的执行简单地包括在布局中的登录按钮,参照按钮下面的XML code:

My current "implementation" simply includes the login button in a layout, by referring to the button with the following XML code:

<com.google.android.gms.common.SignInButton
    android:id="@+id/sign_in_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

在我测试的设备上我的应用程序,该按钮出现在所有红色,有光泽,根据这里所说的<一个指引href="https://developers.google.com/+/mobile/android/sign-in">https://developers.google.com/+/mobile/android/sign-in 。但是,在模拟器上运行时,它只是一个普通按钮(灰色背景,黑色文本)说:在与谷歌。

When I test my app on the device, the button appears all red and shiny, according to the guidelines mentioned here https://developers.google.com/+/mobile/android/sign-in . But when running on the emulator, it's just a normal button (grey background with black text) saying "Sign in with Google".

任何想法,为什么结果不一样?我确信我运行相同的API级别和资源似乎在被拉正确还对仿真器,因为它显示了实际的登录按钮(但具有不同的外观)。

Any idea why the results are different? I've made sure I'm running the same API level, and the resource does seem to get pulled in correctly also on the emulator since it shows the actual login button (but with a different look).

更新:的发现在logcat的线索;消息登录按钮没有发现,使用占位符代替。 pretty的多解释了为什么我看到模拟器上的灰色沉闷的按钮。还需要找出原因;可能是复制谷歌加的apk从设备黑客无法正常工作。

Update: Found a clue in logcat; the message "Sign in button not found, using placeholder instead." pretty much explains why I'm seeing the grey dull button on the emulator. Still need to figure out why; could be the "copy google plus apk's from device" hack isn't working properly.

推荐答案

谷歌Play业务适用于4.2.2版本的Andr​​oid模拟器和作为的Android文档:安装谷歌播放服务

Google Play services works on the 4.2.2 versions of the Android Emulator and is officially supported as described in the Android documentation: Setup Google Play Services.

更新

您现在可以使用Intel / x86映像(HAXM兼容)的API 19和更新,对ARM,谷歌播放服务是大多数的图像。

You now can use the Intel/x86 images (HAXM-compatible) for API 19 and newer and for ARM, Google Play Services is available on most images.

设置的图片

要得到正确的形象,为您的虚拟设备管理器:

To get the right image for your virtual device manager:

  • 打开了Android SDK管理器
  • 打开组的Andr​​oid 4.2.2(API 17)
  • 检查谷歌的API
  • 检查ARM EABI V7A系统映像

要创建虚拟设备:

  • 打开Android虚拟设备管理器
  • 创建一个新的设备
  • 输入的AVD名称
  • 将目标的谷歌的API(谷歌公司) - API级别17
  • 保存您的虚拟设备,并开始吧...
  • Open the Android Virtual Device Manager
  • Create a New device
  • Enter an AVD name
  • Set the target to Google APIs (Google Inc.) - API Level 17
  • Save your Virtual device and start it...

注意 CPU / ABI将被固定为ARM

现在你应该可以使用谷歌播放服务的模拟器。值得注意的是,你需要相应地设置你的目标在你的Andr​​oid项目到谷歌的API,以便谷歌播放服务工作。

Now you should be able to use the Google Play Services in the emulator. Of note, you need to set your target appropriately in your Android project to the Google APIs in order for Google Play Services to work.

这篇关于谷歌播放服务的模拟器,实现谷歌加登录按钮等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆