<small id='QRs9g'></small><noframes id='QRs9g'>

<i id='QRs9g'><tr id='QRs9g'><dt id='QRs9g'><q id='QRs9g'><span id='QRs9g'><b id='QRs9g'><form id='QRs9g'><ins id='QRs9g'></ins><ul id='QRs9g'></ul><sub id='QRs9g'></sub></form><legend id='QRs9g'></legend><bdo id='QRs9g'><pre id='QRs9g'><center id='QRs9g'></center></pre></bdo></b><th id='QRs9g'></th></span></q></dt></tr></i><div id='QRs9g'><tfoot id='QRs9g'></tfoot><dl id='QRs9g'><fieldset id='QRs9g'></fieldset></dl></div>

    1. <tfoot id='QRs9g'></tfoot>
      • <bdo id='QRs9g'></bdo><ul id='QRs9g'></ul>
    2. <legend id='QRs9g'><style id='QRs9g'><dir id='QRs9g'><q id='QRs9g'></q></dir></style></legend>

      模拟器中的 Google Play 服务,实现 Google Plus 登录按钮等

      时间:2023-11-09
      <legend id='U0wzi'><style id='U0wzi'><dir id='U0wzi'><q id='U0wzi'></q></dir></style></legend>

      <small id='U0wzi'></small><noframes id='U0wzi'>

          <bdo id='U0wzi'></bdo><ul id='U0wzi'></ul>
            <tbody id='U0wzi'></tbody>

            <tfoot id='U0wzi'></tfoot>

              • <i id='U0wzi'><tr id='U0wzi'><dt id='U0wzi'><q id='U0wzi'><span id='U0wzi'><b id='U0wzi'><form id='U0wzi'><ins id='U0wzi'></ins><ul id='U0wzi'></ul><sub id='U0wzi'></sub></form><legend id='U0wzi'></legend><bdo id='U0wzi'><pre id='U0wzi'><center id='U0wzi'></center></pre></bdo></b><th id='U0wzi'></th></span></q></dt></tr></i><div id='U0wzi'><tfoot id='U0wzi'></tfoot><dl id='U0wzi'><fieldset id='U0wzi'></fieldset></dl></div>
              • 本文介绍了模拟器中的 Google Play 服务,实现 Google Plus 登录按钮等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在 Android 应用中集成 Google Plus 登录按钮时,我发现按钮在实际设备和模拟器中的显示方式存在一些差异.我知道 Google Plus 服务 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 代码引用按钮:

                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" />
                

                当我在设备上测试我的应用程序时,根据此处提到的指南 https://developers.google.com/+/mobile/android/sign-in .但是在模拟器上运行时,它只是一个普通按钮(灰色背景,黑色文本),上面写着使用 Google 登录".

                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中找到了线索;消息未找到登录按钮,请改用占位符."几乎可以解释为什么我在模拟器上看到灰色沉闷的按钮.仍然需要弄清楚原因;可能是从设备复制 google plus 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.

                推荐答案

                Google Play 服务在 4.2.2 版本的 Android Emulator 上运行,并得到官方支持,如 Android 文档:设置 Google Play 服务.

                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,Google Play 服务可用于大多数映像.

                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 管理器
                • 打开群组 Android 4.2.2 (API 17)
                • 检查 Google API
                • 检查 ARM EABI v7a 系统映像

                创建虚拟设备:

                • 打开 Android 虚拟设备管理器
                • 创建一个新设备
                • 输入 AVD 名称
                • 将目标设置为 Google APIs (Google Inc.) - API Level 17
                • 保存您的虚拟设备并启动它...

                注意 CPU/ABI 将被固定为 ARM

                现在您应该可以在模拟器中使用 Google Play 服务了.值得注意的是,您需要在 Android 项目中将目标适当地设置为 Google API,以便 Google Play 服务正常工作.

                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.

                这篇关于模拟器中的 Google Play 服务,实现 Google Plus 登录按钮等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:为什么 Google Play 商店说我的 Android 应用与我自己的设备不兼容? 下一篇:如何将 android 应用程序限制为特定设备品牌?

                相关文章

                  <tfoot id='yQ85E'></tfoot>

                1. <legend id='yQ85E'><style id='yQ85E'><dir id='yQ85E'><q id='yQ85E'></q></dir></style></legend>

                      <bdo id='yQ85E'></bdo><ul id='yQ85E'></ul>
                  1. <small id='yQ85E'></small><noframes id='yQ85E'>

                    <i id='yQ85E'><tr id='yQ85E'><dt id='yQ85E'><q id='yQ85E'><span id='yQ85E'><b id='yQ85E'><form id='yQ85E'><ins id='yQ85E'></ins><ul id='yQ85E'></ul><sub id='yQ85E'></sub></form><legend id='yQ85E'></legend><bdo id='yQ85E'><pre id='yQ85E'><center id='yQ85E'></center></pre></bdo></b><th id='yQ85E'></th></span></q></dt></tr></i><div id='yQ85E'><tfoot id='yQ85E'></tfoot><dl id='yQ85E'><fieldset id='yQ85E'></fieldset></dl></div>