简体   繁体   English

将Google Cloud Messaging添加到现有的Android项目

[英]Adding Google Cloud Messaging to existing Android project

The android docs recommend you add the gcm library project located at $ANROID_HOME/extras/google/google_play_services/libproject/google-play-services_lib/ , however I don't want to clutter my eclipse workspace with a useless project. android docs建议您添加位于$ANROID_HOME/extras/google/google_play_services/libproject/google-play-services_lib/的gcm库项目,但是我不想用一个无用的项目弄乱我的日食工作区。

After checking the contents of the project I noticed that there is no real code, only a jar ( google-play-services.jar ) and a bunch of resource files. 在检查了项目的内容之后,我注意到没有真正的代码,只有一个jar( google-play-services.jar )和一堆资源文件。

My question is: If I'm only going to use GCM, is it possible to just put that jar in my maven repo as opposed to importing the Android library project? 我的问题是:如果仅使用GCM,是否可以将那个jar放到我的Maven存储库中,而不是导入Android库项目?

I'm not sure if I get your question. 我不确定是否能收到您的问题。 To be able to use GCM, you just need to Add google-play-services.jar in your project path. 要使用GCM,您只需在项目路径中添加google-play-services.jar I successfully added the library by Project>Properties>Java Build Path > Libraries (tab) > Add External Jars and selected the library from C:\\Program Files\\Android\\android-studio\\sdk\\extras\\google\\google_play_services\\libproject\\google-play-services_lib\\libs 我成功地通过Project>Properties>Java Build Path > Libraries (tab) > Add External Jars了库,并从C:\\Program Files\\Android\\android-studio\\sdk\\extras\\google\\google_play_services\\libproject\\google-play-services_lib\\libs选择了库C:\\Program Files\\Android\\android-studio\\sdk\\extras\\google\\google_play_services\\libproject\\google-play-services_lib\\libs

Hope this helps/ 希望这可以帮助/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM