Add gcm.jar in Eclipse IDE (Google Cloud Messaging)

◇◆丶佛笑我妖孽 提交于 2019-12-18 03:17:20

问题


I have a problem as: I didn't find where can I get this Jar file gcm.jar? also where Can I put it ?. Note I used Android 4.1.


回答1:


Start SDK Manager and scroll down to the section "Extras" and make sure you have installed Google Cloud Messaging for Android Library, if not, install the package.

The package will be installed in the directory "your-android-sdk\extras\google\gcm\"

Client code (for example to be used in Android app):
gcm\gcm-client\

Server code (where the Client connects to and registers it's regId):
gcm\gcm-server\

To add the gcm client-jar (gcm.jar) to your Android-project, copy it to the "libs"-folder in your Eclipse project and right click on the file and select Build Path --> Add to Build Path.




回答2:


The GCM Helper libraries (gcm.jar) has been deprecated. The documentation for the library (https://developer.android.com/google/gcm/helper.html) now displays a messaging stating:

The information in this document has been superseded by GCM Server and GCM Client. Please use the GoogleCloudMessaging API instead of the GCM client helper library. The GCM server helper library is still valid.

Implementing a GCM server is documented here: https://developer.android.com/google/gcm/server.html Implementing a GCM client is now documented here: developer.android.com/google/gcm/client.html (sorry, can't post as a link because I don't have enough rep).




回答3:


As on today's date, SDK Manager now has the option to "Show obsolete packages" (Packages->Show obsolete packages). This allows you to install GCM through the SDK Manager itself.




回答4:


Go to this link

https://dl-ssl.google.com/android/repository/gcm_r03.zip

when download completes extract the zip file, you will get three directories with names client side, server side and samples.

now open your SDK folder and create a folder named "extras/android" and paste all three folders here DONE!!

now whenever make a new project in project classpath using add external jar add gcm.jar.

refer




回答5:


Just for the Recored: I followed the steps provided by chrkad but I found the .jar file in the DIST folder and NOT in the JAR folder. After I found that out I saw that Peter Gluck postet that before.

I hope that this could save some time to ppl having this issue! (took me 20 minutes)




回答6:


Seems like this package is now obsolete. In order to see it in SDK Manager I had to check "Show obsolete packages" in the "Packages" menu

See details from answer

https://stackoverflow.com/a/23092848/4255980



来源:https://stackoverflow.com/questions/12264761/add-gcm-jar-in-eclipse-ide-google-cloud-messaging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!