shijin
shijin

Reputation: 3046

Found com.google.android.gms:play-services:8.4.0, but version 8.3.0 is needed for the google-services plugin

Can't use google maps because of above said error. Anyone find the same issue ?

Upvotes: 50

Views: 42199

Answers (9)

ShafayatBayezid
ShafayatBayezid

Reputation: 1

Make sure that the following line is at the end of the app build.gradle file:

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

google update there API day by day.Now mine is '11.0.2' try with the updated API

Upvotes: 0

Shailendra Singh
Shailendra Singh

Reputation: 1

// 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:2.1.0'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
repositories {
    jcenter()
}
}

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

// this should solve the gradle update error if it persists even after following above steps

Upvotes: 0

Bjqn
Bjqn

Reputation: 146

I had the same problem, and I found that moving:

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

To the bottom of the module app gradle.

and then use:

classpath 'com.android.tools.build:gradle:2.1.0' classpath 'com.google.gms:google-services:2.1.0'

Upvotes: 2

Renato Probst
Renato Probst

Reputation: 6054

The problem is that some of your app dependencies that start with com.google.android.gms: have a version that is incompatible your project dependencie classpath 'com.google.gms:google-services:

Check for these on your app build.gradle

compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'

And for this in your project build.gradle

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

You can update your project build.gradle to use the latest google-services version or your can just change your app dependencies to use the 8.3 version.

Upvotes: 0

Greg
Greg

Reputation: 5588

This is a slight variant of @Lord Flash's answer:

For me it wasn't necessarily that I should place the google services plugin at the bottom of the file it was that it should come before the com.android.application plugin.

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

Also there are newer binaries than the alpha variants for google-services

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.gms:google-services:2.0.0-beta6'
    }
}

I'm sure there will be newer ones soon. I found the list of variants here

Upvotes: 5

Tobias
Tobias

Reputation: 7415

As those previous anweres are only part-wise complete. Here are my three steps which worked fine for me:

  1. Put this to the end of your apps build.gradle

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

  2. Set your projects build.gradle dependencies to

    'classpath 'com.google.gms:google-services:2.0.0-alpha5'

  3. Set Gradle Version to 2.10

    Android Studio: File > Project Structure > Project

Upvotes: 27

Super Android
Super Android

Reputation: 201

@redsonic's answer worked for me.. By simply moving apply plugin: 'com.google.gms.google-services' after the dependecies in build.gradle (Module: app)

I'm using Android Studio 1.5.1 with Gradle version 2.10

In case you are using Gradle version older than 2.10 you'll also need to update that by selecting the ProjectName or app directory in the Project tool Windows and pressing F4. This will open Project Structure window, select Project from the menu and update Gradle version to 2.10. Press OK (Android Studio will download it in background).

build.gradle (Project: ProjectName)

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

build.gradle (Module: app)

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:8.4.0'
}

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

Upvotes: 20

redochka
redochka

Reputation: 12829

Make sure that the following line is at the end of the app build.gradle file:

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

Mine was on the top and gradle was defaulting to 8.3.0 instead of what was specified: 8.4.0

My build.gradle files are the same as the ones in the Version conflict updating to 8.4.0

Upvotes: 114

Amer Hadi
Amer Hadi

Reputation: 277

follow all the steps at this link Add App Invites to Your App

use this : compile 'com.google.android.gms:play-services-appinvite:8.4.0'

instead of this : compile 'com.google.android.gms:play-services:8.4.0'

please follow all the steps and then build the project

hope thats help

Upvotes: 2

Related Questions