This article link: http://blog.csdn.net/kongxx/article/details/8155913
Today in the study of Google Cloud Messaging (GCM), use examples in running documents (http://developer.android.com/guide/google/gcm/ demo.html), according to the steps set up server and client, after running server and client, in the simulator running GCM demo always appear "Unfortunately, GCM demo has stopped" Error, checked, and need to modify the place to follow the instructions on the document changed, or error. Finally found that the original choice of AVD has a problem, began to use the "Android 4.1.2-api level 16", and then I replaced AVD "Google APIs (Google Inc.)-API level 16" and then run the client, will not appear on the Face of the problem.
In addition, a problem was found in the test, that is, the document gives two kinds of server choices, one is "using a standard Web server", when using this server selection, configure the client according to the instructions on the document can be run. However, if you use the "using APP Engine for Java", you need to change the Commonutilities.server_url in the client to "http://192.168.1.10:8080" to remove the "/ Gcm-demo, and then run, and you can send the message via "http://192.168.1.10:8080".