can't import import com.google.android.gcm.GCM

2019-08-08 23:53发布

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

but i still got an error on the import

what can be the problem?

3条回答
聊天终结者
2楼-- · 2019-08-09 00:36

first delete google play services from eclipse and clean project

For google play services first install 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

Make sure gcm.jar is exist on your adt

/Users/SS/Desktop/Android/adt-bundle-mac-x86_64-20130717/sdk/extras/google/gcm/gcm-client/dist

查看更多
Summer. ? 凉城
3楼-- · 2019-08-09 00:43

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:

dependencies { compile: "com.google.android.gms:play-services:3.1.+" }

查看更多
ゆ 、 Hurt°
4楼-- · 2019-08-09 00:52

Add GCM.jar in your project from Properties.

查看更多
登录 后发表回答