Phil
Phil

Reputation: 4069

Android Studio - Execution failed for task ':app:processDebugGoogleServices'

In my app level build.gradle file, I have the following dependencies declared

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.android.gms:play-services-location:10.2.1'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:mediarouter-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile "com.google.android.gms:play-services-gcm:10.2.1"
    compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
    compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar' 
}

...which causes me to get warnings on all of the 10.2.1 versions stating that there is a newer version (11.0.1) available and I should use that instead. So, I update each one to point to the 11.0.1 version. The warning goes away, however when I try to perform the Project Sync after I make the changes, I get the error below, which basically tells me to go back to version 10.2.1.

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 10.2.1.

Anyone have any ideas as to WHY this is happening? My Android Studio is completely up-to-date and I'm not sure what to try.

In other similar posts, the solution has been to add apply plugin: 'com.google.gms.google-services' to the bottom of the app build.gradle file, however it's already there.

FULL app level build.gradle file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.MYAPPIDHERE.android"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 104
        versionName = "1.4"
        multiDexEnabled true
    }

    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles 'proguard-project.txt'
        }
    }

    dexOptions {
        preDexLibraries = false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.google.firebase:firebase-core:10.2.1'
    compile 'com.google.android.gms:play-services-location:10.2.1'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:mediarouter-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile "com.google.android.gms:play-services-gcm:10.2.1"
    compile 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
    compile 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
    compile 'me.leolin:ShortcutBadger:1.1.4@aar'
}

repositories {
    maven {
        url "http://dl.bintray.com/microsoftazuremobile/SDK"
    }
    mavenCentral()
}

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

Upvotes: 2

Views: 8730

Answers (2)

Naveen
Naveen

Reputation: 77

Update to the latest version, in both the gradle files

// project lavel build gradle

 dependencies {
    classpath 'com.google.gms:google-services:3.3.1'
}


//app lavel build gradle

dependencies {
implementation 'com.google.firebase:firebase-messaging:15.0.2'}

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

Upvotes: 1

BhalchandraSW
BhalchandraSW

Reputation: 712

Make sure dependencies from group com.google.android.gms and group com.google.firebase have the same version.

For example, current latest version is 11.0.1:

compile 'com.google.firebase:firebase-core:11.0.1' // <- This dependency must also have latest version
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-gcm:11.0.1'

Upvotes: 1

Related Questions