0

I am developing an android App.

I would like to use Google Cloud Messaging. I properly import google-play-services to my project.

I can compile my project correctly, but while running my project I encounter the following error.

java.lang.NoClassFoundError: com.google.android.gms.gcm.GoogleCloudMessaging

The following part of my code causes the above error.

GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this);

I tried the answer of similar questions in StackOverflow like below, however, I still can not solve my problem.

java.lang.NoClassDefFoundError: com.google.android.gms.gcm.GoogleCloudMessaging java.lang.NoClassDefFoundError: com.google.android.gms.gcm.GoogleCloudMessaging after ADT update

Could you tell me how to solve this matter?

Community
  • 1
  • 1
supermonkey
  • 631
  • 11
  • 25
  • Is the error message pasted or typed? Because it says aondroid instead of android. – tritop Dec 03 '14 at 14:22
  • It's my mistake. I editted. – supermonkey Dec 03 '14 at 14:23
  • Have you followed the setup guide which can be found here: http://developer.android.com/google/play-services/setup.html If that is the case it should work. Also remember that Play Services are only available with 4.x Emulators and that you need to include the Google APIs in the setup of the emulator – Carsten Dec 03 '14 at 14:40
  • I see the above setup guide. My procedure of importing google-play-services is not wrong. I use actual device with android 4.4.2. – supermonkey Dec 03 '14 at 15:08
  • Is this with Android studio? I think even with the gradle repo, you still need to import the Google Play Services library jar file in order to use GCM. – Andy Dec 16 '14 at 17:49

0 Answers0