【问题标题】:Android Studio 1.3 RC3. Google Play services out of date. Requires 7571000 but found 6774470安卓工作室 1.3 RC3。 Google Play 服务已过时。需要 7571000 但找到 6774470
【发布时间】:2015-07-21 01:43:29
【问题描述】:

尝试历史

它可能与this 重复 我遵循了 cmets 中的所有建议,但都没有帮助解决。所以我有一个重复的问题,其中包含更多附加信息。

问题

每当我使用下面提到的 AVD 规范运行我的应用程序时,我都会得到一个类似的 logcat

Google Play services out of date. Requires 7571000 but found 6774470. 

详情

这些是我拥有的东西的版本。如果需要任何信息,请告诉我,目前我被阻止希望 GCM 团队的任何人都可以帮助我解决这个问题。

Android Studio 1.3 RC3

分级

root/gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0-beta3'
        classpath 'com.google.gms:google-services:1.3.0-beta1'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

应用程序/gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 22
    buildToolsVersion "21.0.1"

    defaultConfig {
        applicationId "com.mysample.gcm"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            //runProguard false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-gcm:7.5.0'
    compile 'com.android.support:appcompat-v7:+'
}

AVD 信息

SDK 信息

  • 编辑:添加完整的 graddle 文件
  • EDIT2:没有提到这些样本是来自Official sample for GCM 的摘录。

【问题讨论】:

  • 你能把你的整个app/build.gradle发一下吗?
  • 在您的模拟器中转到应用程序管理器并验证 Google Play 服务的版本。
  • @YeLinAung 刚刚添加了完整的 build.gradle。
  • @DanielNugent Google Play Services 模拟器中的版本是 6.7.74 (1723905-470),它在这个问题 6774470 中报告。

标签: android android-emulator google-cloud-messaging android-sdk-tools


【解决方案1】:

问题不在于您的项目或代码,您只需在模拟器中升级 Google Play 服务即可。

您可以轻松地在 onCreate() 覆盖中提示升级您的 Activity(您的项目中也应该为最终用户提供此代码)。

int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (status != ConnectionResult.SUCCESS) {
    if (GooglePlayServicesUtil.isUserRecoverableError(status)) {
        GooglePlayServicesUtil.getErrorDialog(status, this,
                100).show();
    } 
}

您可以在onActivityResult()查看结果:

@Override
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 100){
        int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    }

}

【讨论】:

  • +1 用于快速响应和建议。 github.com/googlesamples/google-services/blob/master/android/... 正是我所拥有的,但由于它在模拟器中运行,更新播放服务不起作用,即使出现提示。
  • @techastute 啊,问题就在这里。不幸的是,除了成功升级 Google Play 服务之外,您无能为力。只知道这严格来说是一个模拟器问题。如果您可以在设备上进行测试,则不会有任何问题。
  • @techastute 你可能想试试Genymotin + 在上面安装 GApps 吗?
  • @YeLinAung 看起来值得一试。但由于我花了 3 个多小时试图修复它,我想知道我做错了什么?此外,在 Genymotin 中安装播放服务的过程看起来是 tiresome。你以前用过 Genymotin+PlayService 吗?
  • @techastute 就像 Daniel 说的那样,模拟器很可能拥有较低版本的 Play 服务(这非常有问题,因为有些设备甚至不附带 Play Store 和 Google Apps)。但是,我建议尝试使用 Genymotion。关于在 Genymotion 上安装 GApp 的更好解释可以在 SO 上找到。是的。我使用 Genymotion + Play Services 已经有一段时间了,它运行良好。 :)
猜你喜欢
  • 2015-08-26
  • 2013-07-25
  • 2013-02-15
  • 2019-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多