Thiago
Thiago

Reputation: 13302

Failed to resolve: com.google.android.gms:play-services-gcm:7.5.+

I am trying to include GCM in my app.

I keep getting this error message :

Failed to resolve: com.google.android.gms:play-services-gcm:7.5.+ | Install Repository and sync project | Show in Project Structure dialog

If I try to Install Repository and sync project i get this error:

Loading SDK information... Ignoring unknown package filter 'extra-google-m2repository'Warning: The package filter removed all packages. There is nothing to install. Please consider trying to update again without a package filter.

Here is my gradle file:

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

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    ...

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:22.2.1'
        compile 'com.google.android.gms:play-services-gcm:7.5.+'

// 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:1.2.3'
        classpath 'com.google.gms:google-services:1.3+'

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

allprojects {
    repositories {
        jcenter()
    }
}

Upvotes: 12

Views: 25983

Answers (7)

Obrazcoff
Obrazcoff

Reputation: 1

For me - help:

  1. to go to Tools -> Android -> SDK Manager
  2. in Android SDK from left list choice tab SDK Tools
  3. Check all need to update packages
  4. You need a lot of free space on disk and a lot of time (for me with SSD disk it takes about 1 hour)

After that your project should work fine.

Upvotes: 0

BlackHatSamurai
BlackHatSamurai

Reputation: 23513

For what it's worth, I had this error when I updated from 10.1.1 to 10.2.0. I tried using 10.2, but found that I had to use the full version number: 10.2.0 (the last zero matters). Hope this helps someone.

Upvotes: 0

Paritosh
Paritosh

Reputation: 367

I know this question has been answered well but just to add something for those who come across a similar error and are seeing this page.

Failed to resolve usually pops up when you are updating the dependencies (read google support libraries) to a newer version and your project is using older version of Google Play Services (look in Android SDK Manager under Extras).

To resolve this just update the Google Play Services to the latest version and then Sync your build.gradle (app). This should resolve similar issues.

Upvotes: 1

FunkSoulBrother
FunkSoulBrother

Reputation: 2167

Updating the SDK resolved this issue for me.

Upvotes: 1

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

Could you check that the necessary packages in your Android SDK Manager are up to date.

And use

compile 'com.google.android.gms:play-services-gcm:7.5.0'

I hope it will helps you .

Upvotes: 12

theblang
theblang

Reputation: 10425

Changing from 7.5.+ to 7.5.0 fixed this issue for me. I'm not sure why the wildcard caused an issue.

Upvotes: 6

Roman Dezhin
Roman Dezhin

Reputation: 11

I once encountered the same error after updating Android Studio and SDK.

You could try to use 'com.android.tools.build:gradle:1.3.0' instead of 'com.android.tools.build:gradle:1.2.3' in Project gradle file.

Upvotes: 1

Related Questions