android-studio - Android Wear : Google Play services out of date. 需要 x 但找到 y

标签 android-studio google-play-services wear-os

我有一个 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/

相关文章:

Android Studio 集成 Google Maps API v2

wear-os - 在CanvasWatchFaceService.Engine onDraw中, Canvas 的宽度和高度可以与边界提供的不同吗?

android - 如何将图像从android上传到Cloudinary?

android - Google Play 服务已过时。需要 3159100 但找到 3158130

android - 当手机进入待机状态(屏幕关闭状态)时, Activity 识别停止接收更新

android - 从 Android 可穿戴设备获取语音输入

wear-os - 唯一标识Android Wear设备

android-studio - 如何在更新到3.4.1时解决“发现了一些冲突”?

java - 不同语言的 String.length() 的计数不同

android - Facebook SDK 导入 Android Studio 并将其添加到我的应用程序中