Android Studio 1.3 RC3. Google Play services out of date. Requires 7571000 but found 6774470

不羁的心 提交于 2019-12-24 06:11:47

问题


Attempt History

It could be a duplicate for this I followed all the suggestions in the comments, none of them helped resolve. So i have a duplicate question with some more additional information.

Issue

Whenever I run my app with the below mentioned spec of AVD, i get a logcat like

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

Details

These are the version of stuffs i have. Please let me know if need any info, currently I'm blocked hope any one from GCM team can help me resolve this.

Android Studio 1.3 RC3

Gradle

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()
    }
}

app/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 Info

SDK Info

  • EDIT: Added complete graddle files
  • EDIT2: Missed mentioning that these samples are an excerpt from Official sample for GCM.

回答1:


The problem is not with your project or your code, you just need to upgrade Google Play Services in your emulator.

You can easily prompt an upgrade in the onCreate() override for your Activity (and you should have this code in your project for end users as well).

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

You can check the result in onActivityResult():

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

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

}


来源:https://stackoverflow.com/questions/31528999/android-studio-1-3-rc3-google-play-services-out-of-date-requires-7571000-but-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!