android - 将Google Play服务从6.5.87更新到7.5.0时出错

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

我正在尝试将Google Play服务库从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:
导入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' }
}

最佳答案

您的错误是您更改了Project标签Gradle而不是App标签。
解:
把编译'com.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'

例:
应用程式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'

}

项目标签分级:
// 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()
    }
}

关于android - 将Google Play服务从6.5.87更新到7.5.0时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31720687/

相关文章:

android - Android 中 DRM 框架的示例/教程

android - 在根项目中找不到任务 'installRelease'

android - 摩托罗拉 EMDK 实现 DataListener 崩溃 |安卓工作室

java - 刷新gradle项目时IntellIj 2018.3 java.lang.AssertionError

android - 如何使用 gradle 在 IntelliJ IDEA 13 中添加 google play 服务

java - 无法在 RecyclerView 中从 Firebase 获取数据

android - 让 Room DAO 返回 LiveData<Cursor>

上传图片时出现android studio错误

android - Android Studio中jpg文件的“the file name must end with .xml”错误

gradle - 运行gradle jetty运行错误