Android Google云消息错误:无法实例化接收器

Android Google云消息错误:无法实例化接收器,android,compiler-errors,broadcastreceiver,runtime-error,google-cloud-messaging,Android,Compiler Errors,Broadcastreceiver,Runtime Error,Google Cloud Messaging,我使用google Play服务遵循google指南中关于新GCM的内容,经过数小时的开发,我成功地在GCM服务器上注册了我的设备,获得了register_ID,并创建了一个php脚本,该脚本可以正确地发送post请求 坏消息是,当我运行应用程序logcat时,我没有收到推送通知,显示以下错误: 12-19 19:48:24.405: E/AndroidRuntime(9570): FATAL EXCEPTION: main 12-19 19:48:24.405: E/AndroidRuntim

我使用google Play服务遵循google指南中关于新GCM的内容,经过数小时的开发,我成功地在GCM服务器上注册了我的设备,获得了register_ID,并创建了一个php脚本,该脚本可以正确地发送post请求

坏消息是,当我运行应用程序logcat时,我没有收到推送通知,显示以下错误:

12-19 19:48:24.405: E/AndroidRuntime(9570): FATAL EXCEPTION: main
12-19 19:48:24.405: E/AndroidRuntime(9570): java.lang.RuntimeException: Unable to instantiate receiver com.baruckis.SlidingMenuImplementation.GcmBroadcastReceiver:
                                            java.lang.ClassNotFoundException: com.baruckis.SlidingMenuImplementation.GcmBroadcastReceiver
12-19 19:48:24.405: E/AndroidRuntime(9570):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2112)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at android.app.ActivityThread.access$1500(ActivityThread.java:127)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at android.os.Looper.loop(Looper.java:137)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at android.app.ActivityThread.main(ActivityThread.java:4507)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at java.lang.reflect.Method.invokeNative(Native Method)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at java.lang.reflect.Method.invoke(Method.java:511)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at dalvik.system.NativeStart.main(Native Method)
12-19 19:48:24.405: E/AndroidRuntime(9570): Caused by: java.lang.ClassNotFoundException: com.baruckis.SlidingMenuImplementation.GcmBroadcastReceiver
12-19 19:48:24.405: E/AndroidRuntime(9570):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-19 19:48:24.405: E/AndroidRuntime(9570):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2107)
12-19 19:48:24.405: E/AndroidRuntime(9570):     ... 10 more
12-19 19:48:52.620: I/Process(9570): Sending signal. PID: 9570 SIG: 9
这是我的清单(我省略了代码中不必要的部分):


谢谢大家!:)

尝试扩展提供的:com.google.android.gcm.GCMBroadcastReceiver

public class MyGCMBroadcastReceiver extends com.google.android.gcm.GCMBroadcastReceiver {
    protected String getGCMIntentServiceClassName(Context context) {
        return GCMIntentService.class.getName();
    }
}

GcmBroadcastReceiver代码中的包行在哪里?更新代码,对不起,我忘记复制和粘贴了!我认为这不是一个可行的解决方案!我需要从Wakefull的接收器上延伸…好的。尝试使用:android:name=“.GcmBroadcastReceiver”代替android:name=“com.baruckis.slidingmenuiimplementation.GcmBroadcastReceiver”。我知道(根据经验),GCM库代码对接收方类相对于目标服务的位置做出了一些假设。试试看。他们的例子显示了在清单中注册为相对包名的接收者。你知道,我认为你应该试试我的第一个答案。如果查看来自GCMBroadcastReceiver的源代码,它将调用:GCMBaseIntentService.runIntentService(上下文、意图、类名);这是一个静态例程,在启动服务之前获取唤醒锁。因此,您不需要WakefulBroadcastReceiver,因为唤醒锁是在onReceive返回之前获取的。这是我使用的,没有任何问题。
package com.baruckis.SlidingMenuImplementation;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;

public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(),
            GcmIntentService.class.getName());
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));
    setResultCode(Activity.RESULT_OK);
   }
}
public class MyGCMBroadcastReceiver extends com.google.android.gcm.GCMBroadcastReceiver {
    protected String getGCMIntentServiceClassName(Context context) {
        return GCMIntentService.class.getName();
    }
}