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

前端 未结 1 1010
情深已故
情深已故 2021-01-20 03:17

I am developing the GCM sample app using http://javapapers.com/android/google-cloud-messaging-gcm-for-android-and-push-notifications/#comment-103785.

I am unable to

1条回答
  •  生来不讨喜
    2021-01-20 03:51

    Here, no need to import google_play_services_lib in your workspace, google_play_services_lib has a jar named google-play-services.jar which needs to be included in your GCM App.

    google-play-services.jar contains all GCM related classes, thats why google_play_services_lib has been added as dependency on GCM Android Project. The simplest thing you can do is to add that jar on your GCM project instead of adding dependency of google_play_services_lib project.

    To add jar in android project you have to do following things,
    1. First create a libs folder under you project, its a libs folder and not lib.
    2. Then copy google-play-services.jar inside libs folder.
    3. Then right click on the google-play-services.jar and select Build Path > Add to Build Path.

    You can see Android Private Libraries created under your project's root folder which will contain this jar.

    Note: Path of jar file - sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs

    0 讨论(0)
提交回复
热议问题