Cannot resolve symbol gcm (Android Studio 0.8.9)

橙三吉。 提交于 2019-12-11 13:58:20

问题


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


回答1:


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.




回答2:


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:


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.

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



来源:https://stackoverflow.com/questions/26395076/cannot-resolve-symbol-gcm-android-studio-0-8-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!