eclipse 无法导入 import com.google.android.gcm.GCMBaseIntentService
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19678787/
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
can't import import com.google.android.gcm.GCMBaseIntentService
提问by Hyman_the_beast
guys i have a huge problem here. i have a project that uses gcm but the import can't be resolved. I've tried all other suggestion on this site and others but nothing seems to work. please help I've downloaded the library copied the jar into my /libs folder and added it to build path
伙计们,我在这里遇到了一个大问题。我有一个使用 gcm 的项目,但无法解决导入问题。我已经尝试了本网站和其他网站上的所有其他建议,但似乎没有任何效果。请帮助我下载了库,将 jar 复制到我的 /libs 文件夹中,并将其添加到构建路径中
but i still got an error on the import
但我仍然在导入时出错
what can be the problem?
可能是什么问题?
回答by morroko
first delete google play services from eclipse and clean project
首先从eclipse和clean项目中删除google play services
For google play services first install Google play Services
对于谷歌播放服务首先安装谷歌播放服务
SDK Manager -> Extras -> Google play Services
SDK Manager -> Extras -> Google play Services
after installing go to
安装后转到
File->import->your SDK folder path ->extras->extras/google/google_play_services/libproject/google-play-services_lib
文件->导入->你的SDK文件夹路径->额外->额外/google/google_play_services/libproject/google-play-services_lib
Make sure gcm.jar is exist on your adt
确保您的广告中存在 gcm.jar
/Users/SS/Desktop/Android/adt-bundle-mac-x86_64-20130717/sdk/extras/google/gcm/gcm-client/dist
/Users/SS/Desktop/Android/adt-bundle-mac-x86_64-20130717/sdk/extras/google/gcm/gcm-client/dist
回答by Sinan Dizdarevi?
http://developer.android.com/google/gcm/client.html
http://developer.android.com/google/gcm/client.html
The key point is that you must reference the library—simply adding a .jar file to your Eclipse project will not work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly. If you're using Android Studio, this is the string to add to the dependency section of your application's build.gradle file:
关键是您必须引用该库——简单地将 .jar 文件添加到您的 Eclipse 项目是行不通的。您必须遵循引用库的说明,否则您的应用将无法访问库的资源,也无法正常运行。如果您使用的是 Android Studio,这是要添加到应用程序 build.gradle 文件的依赖项部分的字符串:
dependencies { compile: "com.google.android.gms:play-services:3.1.+" }
依赖项 { 编译:“com.google.android.gms:play-services:3.1.+”}
回答by URAndroid
Add GCM.jar in your project from Properties.
从 Properties 在您的项目中添加 GCM.jar。