无法在Android Studio中解析符号“ GCMBroadcastReceiver”

男生

我试图在我的Android应用程序中使用GoogleCloudMessaging(GCM)API进行推送通知。

参考http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/http://developer.android.com/google /play-services/setup.html#Setup,我尝试在AndroidManifest.xml中进行设置,但这给了我一些错误:

  • 无法解析符号“ GCMBroadcastReceiver”
  • 无法解析符号“ GCMIntentService”

此块在“应用程序”标签中

    <receiver
        android:name="com.google.android.gcm.GCMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>

            <!-- Receives the actual messages. -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <!-- Receives the registration id. -->
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.zaqqle.disqover" />
        </intent-filter>
    </receiver>

    <service android:name=".GCMIntentService" />

我正在使用Android Studio和已完成的操作

  • 在SDK Manager中安装了Google Play服务并与Gradle同步
  • 包含compile 'com.google.android.gms:play-services:4.3.23'在build.gradle中
  • 包含<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />在AndroidManifest.xml中

您能帮我指出我错过的地方吗?感谢您的帮助!

他们是

com.google.android.gcm.GCMBroadcastReceiver是您的项目中可能没有的不推荐使用的类。您应该实现自己的广播接收器。GCMIntentService是您应该实现的类。

您正在使用的旧教程使用了不推荐使用的类,而不是使用Google Play服务库。您应该参考当前的官方GCM演示应用程序,以查看清单的外观以及项目中应包含的类。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

GcmBroadcastReceiver无法解决问题(Android Studio)

无法实例化GcmBroadcastReceiver

Android Studio无法解析AAR中的符号

无法在Android Studio中解析符号“注释”?

无法在Android Studio中解析符号“ LocationClient”

无法在Android Studio中解析符号WebRTC

无法在 android studio 中解析符号“coordinatorlayout”

无法在Android Studio中解析符号

无法在Android Studio中解析符号getReadableDatabse

无法在Android Studio中解析符号GeoPoint

无法在Android Studio中解析某些符号

Android Studio无法解析符号

无法解析符号Android Studio

错误无法解析 Android Studio 中的符号 activity_main

无法在Android Studio中解析符号HttpGet,HttpClient,DefaultHttpClient

Android Studio中的框架代码“无法解析符号”

无法在Android Studio中解析符号HttpGet,HttpClient,HttpResponce

在Android Studio 3.4.1中无法解析符号'NotificationCompat'

Android Studio无法解析导入的AAR模块中的符号

无法在Java8,Android Studio中解析符号“ LocalDateTime”

无法为Android Studio中的Google集成解析符号“ Auth”

Android Studio MyFirstApp教程中的错误“无法解析符号editText”

尽管同步了项目,但仍无法在Android Studio中解析符号“主题”

如何修复Android Studio中的“无法解析符号'app'”?

无法解析 Android Studio 中的符号“来自”错误

无法在Android中解析符号

如何在android studio中解析符号

在Android 4.0.3上未触发GcmBroadcastReceiver onReceive方法

Android Studio:无法解析符号“ R”