【问题标题】:Error updating Google Play Services from 6.5.87 to 7.5.0将 Google Play 服务从 6.5.87 更新到 7.5.0 时出错
【发布时间】:2015-07-30 10:00:04
【问题描述】:

我正在尝试将 google play services lib 从 6.5.87 更新到 7.5.0,但在 build.gradle 更改了 android 版本之后:

我收到以下错误:

我读到此错误与 appcompat 有关,但我没有使用或包含此库。

这是我完整的 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' }
}

【问题讨论】:

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


    【解决方案1】:

    您的错误是您更改了项目标签 Gradle 而不是 App 标签。 解决方案: 把 compile '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'
    
    }
    

    项目标签 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()
        }
    }
    

    【讨论】:

    • 我添加了类路径、插件并更新了 google-play-services 版本,但仍然遇到同样的错误。
    • 我的项目级和应用级的build.gradle是同一个build.gradle。
    猜你喜欢
    • 2016-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多