I have the gcm.jar in my classpath, so eclipse compiles the project but it fails on my Nexus 4 device with
02-24 11:52:12.645: E/AndroidRuntime(30240): FATAL EXCEPTION: main
02-24 11:52:12.645: E/AndroidRuntime(30240): java.lang.NoClassDefFoundError: com.google.android.gcm.GCMRegistrar
02-24 11:52:12.645: E/AndroidRuntime(30240): at com.foo.closethedoor.CloseTheDoorActivity.onCreate(CloseTheDoorActivity.java:77)
NoClassDefFoundError means the Application is unable to find the location of the file inside the Application's folder. It is advised to keep all the library files and jar files in 'libs' folder of the Project.Try doing so.It will resolve the issue. If not, try building the code again before pushing it onto the device.
It needs to be in your project's
libs/
directory. Do not just manipulate the Eclipse build path manually -- that will allow you compile against the JAR but does not ship the JAR with your APK. Putting the JAR inlibs/
does both.