将Google Play服务从6.5.87更新为7.5.0时出错

时间:2015-07-30 10:00:05

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

我试图将google play服务lib从6.5.87更新到7.5.0但是在build.gradle更改了android版本后:

build.gradle import at 6.5.87

我收到以下错误:

Error after update to 7.5.0

我已经读过这个错误与appcompat有关,但我没有使用或包含此lib。

这是我的完整build.gradle:     import java.util.regex.Pattern

buildscript {
    repositories {
    mavenCentral()

    // Configuration for Fabric
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

        // The Fabric Gradle plugin uses an open ended version to react quickly to Android tooling updates
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric' // Fabric Gradle plugin, always after Android plugin

dependencies {
    // 'jar' files in '/libs' folder
    compile fileTree(dir: 'libs', include: '*.jar')

    compile 'com.facebook.android:facebook-android-sdk:4.1.0'
    compile 'com.google.android.gms:play-services:6.5.87'

    // Fabric
    compile('com.crashlytics.sdk.android:crashlytics:2.+@aar') {
    transitive = true;
    }
}
repositories {
mavenCentral()

// Configuration for Fabric
jcenter()
maven { url 'https://maven.fabric.io/public' }
}

1 个答案:

答案 0 :(得分:0)

您的错误是您更改了Project label Gradle而不是App标签。 解: 把compile&com; go.google.android.gms:play-services:6.5.87' 是App Label Gradel文件也是apply plugin: 'com.google.gms.google-services'

类似地 在项目标签Gradle文件中

classpath 'com.google.gms:google-services:1.3.0-beta1'

实施例: app Gradle:

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

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.appifiedtech.androidgoogleplusapi"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.google.android.gms:play-services:7.5.0'

}

项目标签Gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}