push notification – GCM : java.lang.noclassdeffounderror: com.google.android.gcm.GCMRegistrar-ThrowExceptions

Exception or error:

I am trying to register a device onto GCM using the following code:

    public void onCreate(Bundle savedInstanceState) {

    // the following function can be removed when deploying the app

    final String regId = GCMRegistrar.getRegistrationId(this);
    if (regId.equals("")) {
      GCMRegistrar.register(this, SENDER_ID);
    } else {
      Log.v(TAG, "Already registered");

I have imported import com.google.android.gcm.GCMRegistrar;

and also added GCM.jar to my buildpath in Eclipse which i got thru the sdk download

Please help !

How to solve:

In the updated ADT(Above ADT 17) you have to put jar files inside libs folder and not lib. So make sure that you put gcm.jar file inside libs and not lib folder.


Just go to project properties -> java build path -> “order and export ” now giv a tick on the jar file “GCM.jar” that you have added


My gcm.jar was already in libs, so it wasn’t a folder naming issue for me..

I had to go to Right Click > Build Path > Configure Build path... for the project in question and I removed the following:

  • Any lingering files outside of a folder/bundle
  • Android Private Libraries
  • Any bundles with the word ‘reference’ in them (you may not have one)

You might get a lot of “errors” in your project so restart Eclipse and let it clean. Once it cleans you’ll have no errors. Run your project and viola.

Thanks to DLew for this answer.


Make a folder libs in your project folder and put the gcm.jar in it. Then add it to your class path using add external jars in configure build path option.


You have to put gcm.jar file inside libs, then go to project Properties > Java Build Path > Libraries and add it to your path using Add External JARs…, after in Order and Export you check gcm.jar and press OK. That should work


Make sure that the gcm jar file is in the right libs folder and added into the java build path at your project properties.


I had same problem, after update SDK in my project.
it helped for me: I just “add support library” in “Android tools”. Hope this helps anyone else.


Me also got same problem, after adding android-support-v4.jar and gcm.jar into my libs folder no issues found its work like a charm



The SENDER_ID field should be the project ID from when you created your google api project.
Read the beginning of this: http://developer.android.com/guide/google/gcm/gs.html#libs

TAG should also be a string -> “”tag Name”


Hello You are using old GCM implementations use new implementations available on

Leave a Reply

Your email address will not be published. Required fields are marked *