Cannot resolve symbol gcm (Android Studio 0.8.9)

2019-08-05 05:39发布

Im trying to use Google Cloud Messaging with Android Studio, but it cannot find android:name="com.google.android.gcm.GCMBaseIntentService" and the gcm and GcmIntent appears in read. I have intalled Google play services v 6.1.11. In the build.gradle i have compile "com.google.android.gms:play-services:6.1.11" as dependency. How, i have that installed. I had open the google play services directoy and i havent found gcm. I have gcm installed from sdk manager but still doesnt recognize .GCMBaseIntentService and .GcmIntentService

3条回答
We Are One
2楼-- · 2019-08-05 05:47

Make sure you update or install 'Google Repository' on the SDK manager. Also make sure that you are pointing to the right SDK path. Go to:

File>Project Structure> SDK Location

查看更多
孤傲高冷的网名
3楼-- · 2019-08-05 05:49

GCMBaseIntentService is depicted and part of play service lib (3.1+) so you don't have to add any other jar file. gcm.jar is obsolete now, you can find it in SDK also.

enter image description here

According to android documentation add below line in gradle.build file (latest version)

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

For more info

http://developer.android.com/reference/com/google/android/gms/gcm/GoogleCloudMessaging.html

查看更多
我命由我不由天
4楼-- · 2019-08-05 05:58

com.google.android.gcm.GCMBaseIntentService is an old deprecated class that belonged to the deprecated gcm.jar. Since you are using Google Play Services library, there's no need for you to use GCMBaseIntentService.

查看更多
登录 后发表回答