无法在模拟器中使用Google登录按钮

时间:2014-01-24 12:44:04

标签: android google-play google-play-services

点击Google登录按钮后,会显示以下对话框。

Enter image description here

我点击Update并没有任何反应,但我的logcat提供了以下输出。

01-24 07:38:48.121: W/GooglePlayServicesUtil(1305): Google Play services out of date.  Requires 4132500 but found 4033530
01-24 07:38:50.321: E/SettingsRedirect(1305): Can't redirect to app settings for Google Play services

如何让我的模拟器工作?

失败后,我运行以下命令查看错误并得到以下输出:

C:\adt-bundle-windows-x86_64-20130729\sdk\platform-tools>adb logcat -d -s Packag
eManager:*
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
W/PackageManager(  390): Running ENG build: no pre-dexopt!
D/PackageManager(  390): No files in app dir /vendor/app
W/PackageManager(  390): Package com.example.android.apis desires unavailable sh
ared library com.example.will.never.exist; ignoring!
W/PackageManager(  390): Package com.example.android.apis desires unavailable sh
ared library com.example.will.never.exist; ignoring!
I/PackageManager(  390): Time to scan packages: 5.417 seconds
W/PackageManager(  390): Not granting permission android.permission.GLOBAL_SEARC
H to package com.android.quicksearchbox (protectionLevel=18 flags=0x8be45)
W/PackageManager(  390): Unknown permission com.android.smspush.WAPPUSH_MANAGER_
BIND in package com.android.phone
W/PackageManager(  390): Unknown permission com.android.vending.billing.BILLING_
ACCOUNT_SERVICE in package com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.vending.billing.ADD_CRED
IT_CARD in package com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.vending.billing.IBilling
AccountService.BIND2 in package com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.vending.TOS_ACKED in pac
kage com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.chrome.TOS_ACKED in pack
age com.google.android.gsf.login
W/PackageManager(  390): Not granting permission android.permission.ACCESS_DOWNL
OAD_MANAGER to package com.android.browser (protectionLevel=18 flags=0x9be45)
W/PackageManager(  390): Not granting permission android.permission.SEND_DOWNLOA
D_COMPLETED_INTENTS to package com.android.browser (protectionLevel=2 flags=0x9b
e45)
W/PackageManager(  390): Not granting permission android.permission.BIND_APPWIDG
ET to package com.android.widgetpreview (protectionLevel=18 flags=0x8be44)
W/PackageManager(  390): Unknown permission android.permission.INSTALL_DRM in pa
ckage com.android.mms
W/PackageManager(  390): Not granting permission android.permission.DELETE_PACKA
GES to package com.svox.pico (protectionLevel=18 flags=0x8be45)
W/PackageManager(  390): Not granting permission android.permission.DEVICE_POWER
 to package com.android.deskclock (protectionLevel=2 flags=0x48be45)
W/PackageManager(  390): Not granting permission android.permission.READ_DREAM_S
TATE to package com.google.android.gsf (protectionLevel=2 flags=0x40083e45)
I/PackageManager(  390): No secure containers on sdcard
W/PackageManager(  390): Not granting permission android.permission.GLOBAL_SEARC
H to package com.android.quicksearchbox (protectionLevel=18 flags=0x8be45)
W/PackageManager(  390): Unknown permission com.android.smspush.WAPPUSH_MANAGER_
BIND in package com.android.phone
W/PackageManager(  390): Unknown permission com.android.vending.billing.BILLING_
ACCOUNT_SERVICE in package com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.vending.billing.ADD_CRED
IT_CARD in package com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.vending.billing.IBilling
AccountService.BIND2 in package com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.vending.TOS_ACKED in pac
kage com.google.android.gsf.login
W/PackageManager(  390): Unknown permission com.android.chrome.TOS_ACKED in pack
age com.google.android.gsf.login
W/PackageManager(  390): Not granting permission android.permission.ACCESS_DOWNL
OAD_MANAGER to package com.android.browser (protectionLevel=18 flags=0x9be45)
W/PackageManager(  390): Not granting permission android.permission.SEND_DOWNLOA
D_COMPLETED_INTENTS to package com.android.browser (protectionLevel=2 flags=0x9b
e45)
W/PackageManager(  390): Not granting permission android.permission.BIND_APPWIDG
ET to package com.android.widgetpreview (protectionLevel=18 flags=0x8be44)
W/PackageManager(  390): Unknown permission android.permission.INSTALL_DRM in pa
ckage com.android.mms
W/PackageManager(  390): Not granting permission android.permission.DELETE_PACKA
GES to package com.svox.pico (protectionLevel=18 flags=0x8be45)
W/PackageManager(  390): Not granting permission android.permission.DEVICE_POWER
 to package com.android.deskclock (protectionLevel=2 flags=0x48be45)
W/PackageManager(  390): Not granting permission android.permission.READ_DREAM_S
TATE to package com.google.android.gsf (protectionLevel=2 flags=0x40083e45)
I/PackageManager(  390):   Action: "android.intent.action.SENDTO"
I/PackageManager(  390):   Category: "android.intent.category.DEFAULT"
I/PackageManager(  390):   Scheme: "sms"
I/PackageManager(  390): Adding preferred activity ComponentInfo{com.android.mms
/com.android.mms.ui.ComposeMessageActivity} for user 0 :
I/PackageManager(  390):   Action: "android.intent.action.SENDTO"
I/PackageManager(  390):   Category: "android.intent.category.DEFAULT"
I/PackageManager(  390):   Scheme: "smsto"
I/PackageManager(  390): Adding preferred activity ComponentInfo{com.android.mms
/com.android.mms.ui.ComposeMessageActivity} for user 0 :
I/PackageManager(  390):   Action: "android.intent.action.SENDTO"
I/PackageManager(  390):   Category: "android.intent.category.DEFAULT"
I/PackageManager(  390):   Scheme: "mms"
I/PackageManager(  390): Adding preferred activity ComponentInfo{com.android.mms
/com.android.mms.ui.ComposeMessageActivity} for user 0 :
I/PackageManager(  390):   Action: "android.intent.action.SENDTO"
I/PackageManager(  390):   Category: "android.intent.category.DEFAULT"
I/PackageManager(  390):   Scheme: "mmsto"
I/PackageManager(  390): Adding preferred activity ComponentInfo{com.android.mms
/com.android.mms.ui.ComposeMessageActivity} for user 0 :
W/PackageManager(  390): Attempt to delete unknown system package com.android.ve
nding
W/PackageManager(  390): Attempt to delete unknown system package com.android.ve
nding
W/PackageManager(  390): Attempt to delete unknown system package com.google.and
roid.gms

C:\adt-bundle-windows-x86_64-20130729\sdk\platform-tools>

我该怎么做?

2 个答案:

答案 0 :(得分:2)

模拟器不支持Google Play Services。这就是它抛出错误的原因。要使用API​​进行开发,您需要提供开发设备,例如Android手机或平板电脑。

  

Google Play services out of date.Requires 4132500 but found 4033530

要在模拟器中获取播放服务,您必须自己安装APK文件。

以下是APK gmsvending文件。

使用以下命令安装两个APK文件。

adb install com.android.vending-20130716.apk 
adb install com.google.android.gms-20130716.apk 

如果已经安装然后升级现有的模拟器,则需要使用以下命令卸载以前的版本,然后重新安装:

adb uninstall com.android.vending
adb uninstall com.google.android.gms

答案 1 :(得分:1)

我在页面上找到了解决方案 How to install Google Maps v2 in Android Emulator

它仅适用于Android 4.22,但我认为同样的想法可以应用于带有相应文件的4.4版。

  1. 下载上一页中列出的三个文件:com.android.vending-19032013.apk,com.google.android.gms-19032013.apk和Google Play服务lib r5。

  2. 如果您想使用,请使用Intel Atom(x86)创建具有正常目标(Android 4.22,API 17)的AVD设备。

  3. 从Android控制台安装两个APK文件。

  4. 为Android 4.22创建您的应用

  5. 请勿使用系统的google-play-services-lib。您必须使用第三个下载的文件。