awaistoor
awaistoor

Reputation: 786

Error:Execution failed for task ':app:processDebugGoogleServices'. > Please fix the version conflict

After updating my google play services to rev 28 i'm getting this error. Im not sure why this is happening as it was working fine before.

here is my build.gradle file

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
   compileSdkVersion 23
   buildToolsVersion '23.0.2'

defaultConfig {
    applicationId "com.matsoltech.pakistancurrentaffairs"
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 11
    versionName "2.1.1"
}
buildTypes {
    release {
        multiDexEnabled = true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),      'proguard-rules.pro'
    }
 }
 }

dependencies {
     compile fileTree(include: ['*.jar'], dir: 'libs')
     compile files('src/main/libs/universal-image-loader-1.9.3.jar')
     compile files('src/main/libs/nineoldandroids-2.4.0.jar')
     compile 'com.android.support:appcompat-v7:23.1.0'
     compile 'com.android.support:support-v4:23.1.0'
     compile 'com.android.support:cardview-v7:23.1.0'
     compile 'com.github.ksoichiro:android-observablescrollview:1.5.0'
     compile 'com.google.android.gms:play-services:8.3.0'
     compile 'com.mcxiaoke.volley:library:1.0.18'
     compile 'com.google.android.gms:play-services-analytics:8.3.0'
}

and

buildscript {
repositories {
    jcenter()
}

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.0'
    classpath 'com.google.gms:google-services:1.4.0-beta3'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}
}

So, can anyone please tell me where is the problem? as the code was working fine before the update of GooglePlayServices.

Upvotes: 16

Views: 32406

Answers (13)

jchrix
jchrix

Reputation: 5

  • I copied the google-services.json file i downloaded and pasted it in app root folder i.e in your android studio,

  • Please also make sure the 'google-services.json' file you downloaded has the same name with the one you pasted in the root directory.

This worked for me. thanks

Upvotes: 0

花九流
花九流

Reputation: 1

I met this problem, too. What you say is not the key.

dependencies {
compile 'com.google.android.gms:play-services-auth:11.6.2'
compile 'com.google.android.gms:play-services-plus:11.6.2'
}
apply plugin: 'com.google.gms.google-services'

This apply plugin: 'com.google.gms.google-services' must at dependencies!

Upvotes: 0

Nitesh Pandey
Nitesh Pandey

Reputation: 131

To resolve this error, go to the Project-->platform..>android-->.gradlefile and modify the line

buildscript {
    repositories {
            jcenter()
            mavenLocal()
        }
    dependencies {
        classpath 'com.android.tools.build:gradle:+'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
// apply plugin: 'com.google.gms.google-services'
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin

Upvotes: 0

Roney Thomas
Roney Thomas

Reputation: 1563

change your google-services in Project dependencies to

classpath 'com.google.gms:google-services:3.0.0'

This will fix it.

Upvotes: 27

M'hamed
M'hamed

Reputation: 2598

Use these dependencies for the project build.gradle

dependencies {
    classpath 'com.android.tools.build:gradle:2.3.1'
    classpath 'com.google.gms:google-services:3.0.0'
}

and put this at the end of the app-level build.gradle file (after the dependencies). For some reason I don't understand if you put it at the beginning it will cause problems, make sure you place it at the end.

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

Upvotes: 7

Muhammed Fasil
Muhammed Fasil

Reputation: 8566

Ensure the play services version is latest that you used

Upvotes: 0

Trinadh Koya
Trinadh Koya

Reputation: 1087

I too had the same problem when i was a newbie to Android Development. Though you had everything in place like below

compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'

and you might be placed even the below line in your build.gradle(app level)

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

placing the above piece of code at the bottom of your build.gradle file fix your error

More important thing check your build.gradle(project level) file

apply plugin:  dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }'

com.google.gms:google-services:3.0.0 is placed or not .it won't support old verisons

Upvotes: 0

Daniel Juric
Daniel Juric

Reputation: 148

you need to add this

dependencies {
        compile 'com.google.android.gms:play-services:9.6.1'
}

and remove this

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

Upvotes: 4

Rahul Mca
Rahul Mca

Reputation: 1

You have to Import the google-services.json physically where your project resides eg:C:\Users\User\Desktop\yourproject\

put your google-services.json here in app folder of yourprojects C:\Users\User\Desktop\yourproject\app <----------in this

Upvotes: 0

Shaotim
Shaotim

Reputation: 41

Current version is 2.0.0-beta6...move

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

from the top to the bottom after dependencies as suggested though, I added it to the bottom not realizing it was already at the top. Having it twice by accident annoyed me.

Upvotes: 3

AAnkit
AAnkit

Reputation: 27549

What solved it for me is to get latest version of google services from below link. Just needed to use latest version for classpath 'com.google.gms:google-services:2.0.0-beta4'

https://bintray.com/android/android-tools/com.google.gms.google-services/

Upvotes: 2

Thiago
Thiago

Reputation: 13302

try this

dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
    classpath 'com.google.gms:google-services:2.0.0-alpha3'
}

Upvotes: 0

Emmanuelguther
Emmanuelguther

Reputation: 1059

If you are only using play-services-analytics: delete this

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

The entire library is heavy. And now you can take the part that you need. Analitycs, gcm etc. So you're actually taking twice Analytics

Upvotes: 3

Related Questions