0

This is really annoying. I've wasted a whole day but haven't received any proper result. I'm trying to add Google Cloud Messages into my app. I'm using Eclipse last version. ADT last version. I've added google-play-services_lib as Library, added the jar file in Build path but my app drops at the code line below:

GoogleCloudMessaging regId = GoogleCloudMessaging.getInstance(_.appContext);

java.lang.NoClassDefFoundError!

How to solve this problem?

Simon Peverett
  • 4,128
  • 3
  • 32
  • 37
Vyacheslav
  • 26,359
  • 19
  • 112
  • 194
  • Looks like a proguard obfuscation issue. – Stan Apr 27 '15 at 14:24
  • no proguard I've used. It seems the app do not see google-play-services_lib classes. I do not understand why. – Vyacheslav Apr 27 '15 at 14:24
  • Try to clean/rebuild the project in Eclipse. – Stan Apr 27 '15 at 14:29
  • It is runtime error, adding jar to classpath solves compile time errors, you need to make sure jar is getting packaged to make it available during run time. Assuming this jar is supported in run time, -->Go to Eclipse right click on project --> Go to "Java Build Path" --> Go to tab "Order...." and select the jar. – kosa Apr 27 '15 at 14:41
  • Already did all those obvious solutions – Vyacheslav Apr 27 '15 at 14:48
  • Have you selected the "Google APIs" of your selected API version as Project Build target of your project? See also: http://stackoverflow.com/questions/16619450/cannot-resolve-symbol-googlecloudmessaging-gcm – Robert Apr 27 '15 at 15:23
  • Of course. It doesnt work on both machines with eclipse I have. – Vyacheslav Apr 27 '15 at 15:27
  • Downvoted? really funny. I've just unswered my question. – Vyacheslav Apr 28 '15 at 11:43

1 Answers1

0

The problem is the bug of SDK and Eclipse. The library google-play-service.jar didn't attached in a proper way. Just full reinstalling Eclipse (with ADT) and SDK helped to me. The connected question about all classes (not only Cloud Messages) is here. Do not forget about memory increasing in eclipse.ini file.

Community
  • 1
  • 1
Vyacheslav
  • 26,359
  • 19
  • 112
  • 194