title: Android GCM Client exception
body: <p>I'm recently started to learn about Android GCM. I am trying the GCM Client sample given in Android Developer at <a href="http://developer.android.com/google/gcm/client.html" rel="nofollow">here</a>, and when i tried to click the send button in the MainActivity, it gave me some exception as below: </p>
  
  <pre><code>09-06 00:16:41.480: E/AndroidRuntime(1246): FATAL EXCEPTION: main
  09-06 00:16:41.480: E/AndroidRuntime(1246): java.lang.RuntimeException: Unable to instantiate receiver com.google.android.gcm.demo.app.GcmBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gcm.demo.app.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.google.android.gcm.demo.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.android.gcm.demo.app-1, /vendor/lib, /system/lib]]
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2405)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at android.app.ActivityThread.access$1500(ActivityThread.java:141)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1332)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at android.os.Looper.loop(Looper.java:137)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at android.app.ActivityThread.main(ActivityThread.java:5103)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at java.lang.reflect.Method.invoke(Method.java:525)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at dalvik.system.NativeStart.main(Native Method)
  09-06 00:16:41.480: E/AndroidRuntime(1246): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gcm.demo.app.GcmBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.google.android.gcm.demo.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.google.android.gcm.demo.app-1, /vendor/lib, /system/lib]]
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2400)
  09-06 00:16:41.480: E/AndroidRuntime(1246):     ... 10 more
  </code></pre>
  
  <p>(sorry that i'm not able to post image due to my insufficient of reputation.)</p>
  
  <p>I'm using emulator as below</p>
  
  <p><strong>Target: Google API Level - 18</strong></p>
  
  <p>and added Google account to it (which i think is not neccessary, because i'm using android 4.3).</p>
  
  <p>At the server side, i tried to built a WCF service and send a HTTP POST request, and got the following response: </p>
  
  <p>"<strong>STATUS: 200 - OK
  id=0:1378440485753994%921c249af9fd7ecd</strong>"</p>
  
  <p>besides, i also tried using GCM testing server at <a href="http://helmibaraja.com/gcm_demo.html" rel="nofollow">helmibaraja.com</a>, and got the following response</p>
  
  <p>"<strong>{"multicast_id":6425765079749845115,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1378441452317757%921c249af9fd7ecd"}]}</strong>"</p>
  
  <p>so i'm thinking the server side is not a problem.</p>
  
  <p>I'm hoping someone corrected me at the client side, on the emulator setting, or etc...</p>
  
  <p>Btw, i also imported the "<strong>google-play-services_lib</strong>" to my package explorer and added "<strong>gcm.jar</strong>" and "<strong>gcm-src.jar</strong>" to my project's Java Build Path.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>CORRECTION:</strong> the above exception is caused when click on the button in the demo client app.</p>
  
  <p>The following logs show when send GCM from the server.</p>
  
  <pre><code>09-06 01:13:51.580: W/BroadcastQueue(274): Unable to launch app com.google.android.gcm.demo.app/10057 for broadcast Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10 pkg=com.google.android.gcm.demo.app (has extras) }: process is bad
  09-06 01:13:51.610: W/GTalkService(466): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.google.android.gcm.demo.app (has extras) }
  </code></pre>