I have read all the post about this argument and I try all but i can't find a solution I try to add to my app Google Cloud Messaging start follow the official google guide at http://developer.android.com/google/gcm/client.html and http://developer.android.com/google/play-services/setup.html#Setup I install Playservices through Android SDK Manager and now I can't view the folder in android-sdk\extras\google\google_play_services
In Eclipse Kepler: File -> Import -> Existing Android Code into Workspace
Root Directory:
....android-sdk\extras\google\google_play_services\libproject\google-play-services_lib
Copy project into workspace is selected.
Now i have play services library project in my workspace and listed in Package explorer and I can add reference to my project
My project -> Properties -> Android -> Library -> add... --> select google-play-services_lib -> ok -> Apply
In Java Build Path -> Order and Export I find:
.../gen ->selected
.../src ->selected
Android Private Libraries ->selected
Android 4.2.2 ->not selected
Android Dependencies ->selected
I continue the google guide "Implementing GCM Client" Add lines to my manifest file and modify my onCreate and onresume like explained in "Check for Google Play Services APK"
All is ok and no compile error in eclipse.
When I try to run on emulator or on physical device (Galaxy S3 - Android 4.3) I have runtime error in logcat:
java.lang.NoClassDefFoundError: com.google.android.gms.common.GooglePlayServicesUtil
This is the code that have generate the error:
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
Seems that need library is not export in apk....
What I missing to do?
import com.google.android.gms.common.GooglePlayServicesUtil;
at the top of your file. – Akshayimport com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
eclipse don't notify me any compile error.... may be a bug? – erik