Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed

29,825

Solution 1

In your top-level build.gradle file you need to update the dependencies to use

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

Extra Info: The latest version of this can be found by looking at the entry on JFrog Bintray

Further Update: Yes this has been updated since I answered the question. The latest version is:

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

However, it's always worth following the provided link to find the latest version.

Solution 2

Working solution for 8.4.0 (maybe same for previous versions too with this crazy issue)

project build.gradle:

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

app/mobile build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'android-apt'

android {
    ...
    ...
    ...
}

dependencies {
    // Google Play Services
    compile 'com.google.android.gms:play-services-analytics:8.4.0'
    // another play services in v8.4.0
}

apply plugin: 'com.google.gms.google-services' // why here on end? Because GOOGLE...

WARNING: When you move apply plugin: 'com.google.gms.google-services' on top of build gradle, it can not compile...

Solution 3

The Google Play Services guides saved me from this problem

According to the guide,

In versions of Google Play services prior to 6.5, you had to compile the entire package of APIs into your app. In some cases, doing so made it more difficult to keep the number of methods in your app (including framework APIs, library methods, and your own code) under the 65,536 limit.

From version 6.5, you can instead selectively compile Google Play service APIs into your app. For example, to include only the Google Fit and Android Wear APIs, replace the following line in your build.gradle file:

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

with these lines:

compile 'com.google.android.gms:play-services-fitness:8.4.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'

Solution 4

I encountered this issue as well, although mine was

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

To fix, I combined Jeff Sutton and mtrakal's answers. I had to make sure I was using the latest Gradle plugin and Google Services versions in the project-level Gradle file (I had Gradle 1.5 and it didn't work):

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

classpath 'com.android.tools.build:gradle:2.0.0-beta6'

Then I put the apply plugin: 'com.google.gms.google-services' line in the last line of the app Gradle file.

Share:
29,825
Bakus123
Author by

Bakus123

Updated on July 08, 2020

Comments

  • Bakus123
    Bakus123 almost 4 years

    I just updated Google play services to the latest release - 23 - in the Android SDK Manager. Next I updated dependency in my project to: com.google.android.gms:play-services-gcm:8.3.0

    But I got:

    Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
    Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
    Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
    Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
    Found com.google.android.gms:play-services-gcm:8.3.0, but version 8.1.0 is needed
    :app:processDebugGoogleServices FAILED
    Error:Execution failed for task ':app:processDebugGoogleServices'.
    > Please fix the version conflict.
    

    What is wrong? Do you have this problem also?

  • user987760
    user987760 over 8 years
    classpath 'com.google.gms:google-services:+' works for all
  • Rashid
    Rashid over 8 years
    Google has not updated its documents yet, Respect @iNdieboy-Jeff
  • Ridcully
    Ridcully over 8 years
    What a mess! Google services get more and more complicated and confusing.
  • Bakus123
    Bakus123 over 8 years
    @user987760, we don't should use '+' in version number. Android studio warning: Avoid using + in version numbers, can lead to unpredictable and unrepeatable builds.
  • RussHWolf
    RussHWolf over 8 years
    What's the best way to find this version number? It's pretty frustrating that it's not always up-to-date in official documentation.
  • Jeff Sutton
    Jeff Sutton over 8 years
    You can see what the latest version of this is by looking at bintray.com/android/android-tools/…
  • René Jahn
    René Jahn over 8 years
    @Brucelet You can also set ":+" at the end and run ./gradlew -q dependencies. There you can see to which version the plus has been resolved. Then just replace the plus by this version number.
  • Yuntao
    Yuntao over 8 years
    While using + in version number works, it can lead to unpredictable and unrepeatable builds. It is recommended to specify a version number, so that the exact dependencies are defined, and the same build can be repeatedly built.
  • Gopal Singh Sirvi
    Gopal Singh Sirvi over 8 years
    can you please explain why moving this line to top not compiling? I was trying to update google play services version and i stucked and finally your solution worked, but what is the reason behing this logic to move it to bottom?
  • mtrakal
    mtrakal over 8 years
    I would, but I have no idea :(. I stuck on this problem maybe two days until I found working solution from some google example project when I search differencies from my code and theirs :/
  • Jeff Sutton
    Jeff Sutton over 8 years
    @Emzor - my answer does provide a link that will show the latest released version number. It is not practical or reasonable to expect me to update an answer every time google releases a new version. As the answer is several months old it is reasonable for you to follow the link I provided to see what the latest version is.