Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't resolve "com.google.android.gms.gcm.GcmReceiver"?

I'm trying to implement GCM push notifications on my android app and I'm following the guide here https://developers.google.com/cloud-messaging/android/client to the best of my understanding but I'm getting the error in Android Studio saying "can't resolve symbol: GcmReceiver"

I've literally just copy pasted what it says in the guide to my manifest and installed Google Play Services through the SDK Manager but it's still telling me it can't resolve it.

enter image description here

My understanding is that this a class that should be located in the classpath somewhere now that I've added the library considering all of the other classes like "MyGcmListenerService" have a custom package whereas it has a static one. Nowhere I've looked is helpful on this issue, can anyone please tell me what I'm doing wrong?

My code (literally just copy pasted from the example):

    <receiver
        android:name="com.google.android.gms.gcm.GcmReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="gcm.play.android.samples.com.gcmquickstart" />
        </intent-filter>
    </receiver>
like image 558
Andrew Avatar asked Feb 10 '23 02:02

Andrew


1 Answers

Check if you added the dependency to your app's level gradle script.

dependencies { compile "com.google.android.gms:play-services:7.5.+" }

like image 82
InvertedNetwork Avatar answered Feb 11 '23 16:02

InvertedNetwork