Android SDK 管理器 GCM 库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11293424/
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 06:47:10  来源:igfitidea点击:

Android SDK manager GCM library

androidgoogle-cloud-messaging

提问by Zelter Ady

I just saw that google deprecated the C2DM and replace it by GCM. On their websitethey describe us, step by step, the way to follow to install the GCM library required to start implementing the new android push notification (or Cloud Messaging, as they name it).

我刚刚看到谷歌弃用了 C2DM 并用 GCM 替换了它。在他们的网站上,他们一步一步地向我们描述了安装 GCM 库所需的方法,以开始实施新的 android 推送通知(或云消息传递,正如他们所称)。

On the "Install the Helper Libraries" is written:

在“安装帮助程序库”上写着:

To perform the steps described in the following sections, you must first install the helper libraries (reference: client and server). From the SDK Manager, install Extras > Google Cloud Messaging for Android Library. This creates a gcm directory under YOUR_SDK_ROOT/extras/google/ containing these subdirectories: gcm-client, gcm-demo-appengine, gcm-demo-client, gcm-demo-server, and gcm-server.

要执行以下部分中描述的步骤,您必须首先安装帮助程序库(参考:客户端和服务器)。在 SDK 管理器中,安装 Extras > Google Cloud Messaging for Android Library。这会在 YOUR_SDK_ROOT/extras/google/ 下创建一个 gcm 目录,其中包含以下子目录:gcm-client、gcm-demo-appengine、gcm-demo-client、gcm-demo-server 和 gcm-server。

I opened the SDK manager from Eclipse, but under the Extras is nothing except "Intel hardware accelerated execution manager". I don't see something else.

我从 Eclipse 中打开了 SDK 管理器,但在 Extras 下除了“英特尔硬件加速执行管理器”之外什么也没有。我没有看到别的东西。

How do I find/add/install the GCM in SDK manager?

如何在 SDK 管理器中查找/添加/安装 GCM?

采纳答案by Zelter Ady

None of the previous suggestion worked for me. But...

以前的建议都不适合我。但...

I found something strange: if I start the SDK manager from Eclipse (Windown -> Android SDK manager) I don't see all the updates. If I go to the filesystem, in windows explorer, and I start the SDK manager from there I have a bigger list of available packages.

我发现了一些奇怪的东西:如果我从 Eclipse(Windown -> Android SDK 管理器)启动 SDK 管理器,我看不到所有更新。如果我在 Windows 资源管理器中转到文件系统,然后从那里启动 SDK 管理器,我将获得更大的可用软件包列表。

Strange but worked for me!

奇怪但对我有用!

回答by pyus13

The Best and easiest way I got after trying a lot of time

我尝试了很多时间后得到的最好和最简单的方法

Go to this link

转到此链接

https://dl-ssl.google.com/android/repository/addon.xml

https://dl-ssl.google.com/android/repository/addon.xml

at the end of this page you will find a section Google cloud messaging for androidwith following line

在本页的末尾,您将找到Google cloud messaging for android包含以下行的部分

<sdk:url>gcm_r03.zip</sdk:url>

just replace addon.xml by gcm_r03.zipin url mentioned above, The final url will look like this

只需替换by gcm_r03.zip上面提到的 url 中的addon.xml ,最终 url 将如下所示

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 在项目类路径中创建一个新项目时。

I have explained the whole process because same can be used to download other SDK stuff like platform-tools and platforms as zip so you can configure eclipse without an internet connection anywhere.

我已经解释了整个过程,因为同样可以用来下载其他 SDK 的东西,比如平台工具和平台作为 zip,这样你就可以在没有互联网连接的情况下在任何地方配置 eclipse。

回答by ANinJa

Just open your SDK and Click to Obsolatebelow and you will find the Google Cloud Messaging for Android Library

只需打开您的 SDK 并点击Obsolate下方,您将找到Google Cloud Messaging for Android Library

回答by Arunkumar

Above not work for me.I tried this way...Go to sdk manager, check obsolete... gcm library will come. it works for me..

以上对我不起作用。我试过这种方式......去sdk经理,检查过时......gcm库会来。这个对我有用..

回答by azgolfer

You have to upgrade your SDK Tools to rev 20 and Platform-tools to rev 12 before the 'Google Cloud Messaging for Android Library' will appear in the 'Extras' folder.

您必须将 SDK 工具升级到 rev 20,将 Platform-tools 升级到 rev 12,然后“Google Cloud Messaging for Android Library”才会出现在“Extras”文件夹中。

Also, if you already have a working C2DM project, you just need to change the SENDER_ID, without including the GCM library

另外,如果您已经有一个可以工作的 C2DM 项目,您只需要更改 SENDER_ID,而不包括GCM 库

回答by Khushboo

Yes Zelter Ady is right. I also faced the same secanrio but when I accessed SDK manager from Windows Explorer (on my windows machine) C:\Program Files\Android\android-sdk, I am able to get a bigger list of updates under which SDK 4.1 (API 16) is also there apart from Extras->Google cloud Messaging for Android. I was unable to update SDK with API 16 from Eclipse plugin of SDK Manager.

是的 Zelter Ady 是对的。我也遇到了同样的 secanrio,但是当我从 Windows 资源管理器(在我的 Windows 机器上)C:\Program Files\Android\android-sdk 访问 SDK 管理器时,我能够获得更大的更新列表,其中 SDK 4.1(API 16) ) 除了适用于 Android 的 Extras->Google Cloud Messaging 之外,也有。我无法通过 SDK Manager 的 Eclipse 插件使用 API 16 更新 SDK。

回答by Steve

For Android Studio version 1.5:

对于 Android Studio 1.5 版:

Go to Tools -> Android -> SDK -> click Launch standalone below in sdk manager, it will open new window -> Check Obsolete below -> install Google Cloud Messaging for Android Library

转到工具 -> Android -> SDK -> 在 sdk 管理器中单击下方的 Launch Standalone,它将打开新窗口 -> 在下方检查已过时 -> 安装 Google Cloud Messaging for Android Library

回答by Klaasvaak

Update your SDK manager in Eclipse: Help -> Check for updates. Install updates.

在 Eclipse 中更新您的 SDK 管理器:帮助 -> 检查更新。安装更新。