简体   繁体   中英

Conflict by updating the version of the google-services

I try to update the version of my librairies in my app. The problem is I have this error :

Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.

I really don't understand because I change the classpath to the last versions too. What is wrong ?

This is my gradle app :

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.22.1'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    defaultConfig {
        applicationId "my.project"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 70
        versionName "2.4.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
apply plugin: 'com.google.gms.google-services'
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services:10.2.4'
    compile 'id.zelory:compressor:1.0.4'
    compile 'com.squareup.okhttp:okhttp:2.2.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
    compile 'com.github.siyamed:android-shape-imageview:0.9.2@aar'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'zh.wang.android:yweathergetter4a:1.3.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
}

This is my Gradle project :

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

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Change this:

compile 'com.google.android.gms:play-services:10.2.4'

to

compile 'com.google.android.gms:play-services:9.0.0'

then try syncing the project.

Maybe you are using a library that is dependent on that specific version of Google play services and hence the version conflict.

Solution is very simple:

Just comment the below lines in cordova-plugin-fcm/projectname-FCMPlugin.gradle file.

// apply plugin: 'com.google.gms.google-services'
//apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

Let me know if this fixes your issue

@Anamika Rathore's answer won't work because based on your gradle version and this below line

*

apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

*

in cordova-plugin-fcm/projectname-FCMPlugin.gradle file. when you compile your project build.gradle file will be auto updated and set this line from

compile 'com.google.android.gms:play-services:9.0.0'

to

compile 'com.google.android.gms:play-services:10.2.4'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM