Android 在 Eclipse IDE (Google Cloud Messaging) 中添加 gcm.jar

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12264761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:15:02  来源:igfitidea点击:

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

androidgoogle-cloud-messaging

提问by egydeveloper

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.

我有一个问题:我没有找到在哪里可以得到这个 Jar 文件 gcm.jar?还有我可以把它放在哪里?。注意我使用的是 Android 4.1。

回答by kaderud

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

启动SDK Manager并向下滚动到“Extras”部分,并确保您已安装Google Cloud Messaging for Android Library,如果没有,请安装该软件包。

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

软件包将安装在目录“ your-android-sdk\extras\google\gcm\”中

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

客户端代码(例如在 Android 应用中使用):
gcm\gcm-client\

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

服务器代码(客户端连接并注册它的 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.

要将 gcm client-jar (gcm.jar) 添加到您的 Android 项目,请将其复制到Eclipse 项目中的“ libs”文件夹,然后右键单击该文件并选择Build Path --> Add to Build Path

回答by iwinoto

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:

GCM 帮助程序库 (gcm.jar) 已被弃用。该库的文档 ( https://developer.android.com/google/gcm/helper.html) 现在显示一条消息说明:

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.

本文档中的信息已被 GCM 服务器和 GCM 客户端取代。请使用 GoogleCloudMessaging API 而不是 GCM 客户端帮助程序库。GCM 服务器帮助程序库仍然有效。

Implementing a GCM server is documented here: https://developer.android.com/google/gcm/server.htmlImplementing 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).

此处记录了 GCM 服务器的 实现:https: //developer.android.com/google/gcm/server.html现在记录了 GCM 客户端的实现:developer.android.com/google/gcm/client.html(抱歉,不能作为链接发布,因为我没有足够的代表)。

回答by Teddy

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.

从今天起,SDK Manager 现在可以选择“显示过时的包”(Packages->Show obsolete packages)。这允许您通过 SDK Manager 本身安装 GCM。

回答by sujith s

Go to this link

转到此链接

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

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.

下载完成后解压缩 zip 文件,您将获得三个目录,名称分别为客户端、服务器端和示例。

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

现在打开您的 SDK 文件夹并创建一个名为“extras/android”的文件夹并将所有三个文件夹粘贴到此处完成!!

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

现在每当使用 add external jar add gcm.jar 在项目类路径中创建一个新项目时。

refer

参考

回答by Langusten Gustel

Just for the Recored: I followed the steps provided by chrkadbut I found the .jar file in the DISTfolder and NOTin the JARfolder. After I found that out I saw that Peter Gluckpostet that before.

仅用于记录:我按照chrkad提供的步骤操作,但我在DIST文件夹中找到了 .jar 文件,而不是JAR文件夹中。之后,我发现了,我看到彼得·格鲁克postet之前。

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

我希望这可以为遇到此问题的人节省一些时间!(花了我 20 分钟)

回答by Sakib Hasan

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

好像这个包现在已经过时了。为了在 SDK Manager 中看到它,我必须在“Packages”菜单中选中“Show obsolete packages”

See details from answer

从答案中查看详细信息

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

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