GcmListenerService is not available

217 views Asked by At

I am trying to send upstream message and I want to implement GcmListenerService but it is not defined in Android studio. I mean, it is not available in the auto-complete. please have a look at the below posted gradle files and let me know how to fix this issue

build.gradle (app):

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':appcompat')
compile project(':securepreferences')
compile 'com.android.support:support-v4:25.2.0' // .0.1
compile 'com.google.android.gms:play-services:4.3.23'


compile 'com.github.chrisbanes.photoview:library:1.2.4'
compile 'com.google.code.gson:gson:2.7' // 2.4

compile 'com.squareup.picasso:picasso:2.4.0'

compile 'com.squareup.retrofit:retrofit:1.8.0'

compile files('app/libs/android-viewbadger.jar')
compile files('app/libs/iDappsImagesLib_v0.2.jar')
compile files('app/libs/iDappsToolsLib_v0.1.jar')
compile files('gradle/wrapper/gradle-wrapper.jar')

}

build.gradle(proj):

buildscript {
repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7' // 1.8?

}
}
allprojects {
repositories {
    jcenter()
    mavenCentral()
}
}
2

There are 2 answers

2
Emílio Fonseca On

Try adding thie line to your app build.gradle

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

And resync your project again :D

0
Pavan On

GCM is not recommended any more.. check this out to use latest FCM which does same thing as GCM

https://developers.google.com/cloud-messaging/android/client