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

I am trying to implement GCM push notifications on my Android application and I follow the guide here https://developers.google.com/cloud-messaging/android/client to the best of my understanding, but I get an error in Android Studio saying "not can resolve symbol: GcmReceiver "

I literally just copied what he says in the manual for my manifest and installed Google Play Services through the SDK Manager, but he still tells me that he cannot solve it.

enter image description here

I understand that this class, which should be located in the class path, now that I have added the library, considering all other classes, such as MyGcmListenerService, it has its own package, while it has a static one. Nowhere do I look useful in this problem, can someone tell me what I am doing wrong?

My code (literally just copy it in 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>
+4
source share
1 answer

Check if the dependency is added to the level of your application gradle script.

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

+7
source

Source: https://habr.com/ru/post/1606862/


All Articles