我有一个 Android Wear 应用程序,我正在尝试将其从 Eclipse 迁移到 Android Studio。它(或多或少)在我的 LG G Watch 上运行,但在我的 Moto 360 上运行时,我在 logcat 中收到以下消息:
GooglePlayServicesUtil﹕ Google Play services out of date. Requires 6111000 but found 5091534
紧随其后的是 与 Google API 客户端的连接失败
。在模拟器上运行会给出类似的信息:
GooglePlayServicesUtil﹕ Google Play services out of date. Requires 6111500 but found 5077534
令我感到奇怪的是,Requires
版本在每种情况下都略有不同,但就是这样。
我在 SO 上遇到过类似的问题,答案通常归结为确保模块的 Gradle 依赖项使用 play-services-wearable
而不仅仅是 play-服务
。我已经检查过了,它似乎是正确的;这是我的 build.gradle 文件中的相关部分:
dependencies {
compile project(':wearableCommon')
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}
请注意,wearableCommon
是我自己的一个库,包含我在几个可穿戴项目中使用的代码,它不使用 GMS。
令我特别困扰的是,这在一台设备上有效,但在另一台设备上无效。如果我内部没有 360,我可能会在我的 G Watch 上测试后发布此代码。那时我会处于尝试在野外调试它的位置,同时为数百个愤怒的 360 所有者做损害控制。
最佳答案
最简单的“修复”:
将您的 play-services-wearable
设置为专门查找 5.0.77
编译 'com.google.android.gms:play-services-wearable:5.0.77'
更多信息:
https://plus.google.com/u/0/101581283591300788111/posts/5bHfmjtvQ6R
我确实遇到了完全相同的问题。韦恩正试图帮助我解决这个问题。喜欢的可以加入讨论。
关于android-studio - Android Wear : Google Play services out of date. 需要 x 但找到 y,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26387190/