obteniendo el error java.lang.NoClassDefFoundError: com.google.android.gms.common.GooglePlayServicesUtil

I know it'a already many questions was like this, I read all of them, and can't find solution anyway. What i did:

I did all this steps fine from http://developer.android.com/google/play-services/setup.html#Install to install google play sdk In my project property in Android tab I have "google play service library" ok, in Java Builder Path: "Android Private Libraries" i have google-play-service.jar, and this library are selected. I did Import lib project also.

Code for testing i took from http://developer.android.com/google/gcm/client.html. My manifest file:

    android:targetSdkVersion="19" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.intent.RECEIVE" />

    android:protectionLevel="signature" />

<uses-permission android:name="lt.vaziouju.vaziuoju.permission.C2D_MESSAGE" />

    android:theme="@style/AppTheme" >

        android:value="api key here" />

        android:permission="lt.vaziouju.vaziuoju.c2dm.permission.SEND" >
            <action android:name="lt.vaziouju.vaziuoju.c2dm.intent.RECEIVE" />

            <category android:name="lt.vaziouju.vaziuoju" />

    <service android:name="lt.vaziouju.vaziuoju.GcmIntentService" />


My java code: package lt.vaziouju.vaziuoju;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;

public class Test_GCM extends Activity {

private final static int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
private static final String TAG = null;

protected void onCreate(Bundle savedInstanceState) {

    TextView mDisplay = (TextView) findViewById(R.id.display);

    Context context = getApplicationContext();

    // Check device for Play Services APK.
    if (checkPlayServices()) {
        // If this check succeeds, proceed with normal processing.
        // Otherwise, prompt user to get valid Play Services APK.

// You need to do the Play Services APK check here too.
protected void onResume() {

 * Check the device to make sure it has the Google Play Services APK. If
 * it doesn't, display a dialog that allows users to download the APK from
 * the Google Play Store or enable it in the device's system settings.

private boolean checkPlayServices() {
    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(resultCode, this, PLAY_SERVICES_RESOLUTION_REQUEST).show();
        } else {
            Log.i(TAG, "This device is not supported.");
        return false;
    return true;

public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.test__gcm, menu);
    return true;


If you have any idea how I can it, it will be grate. I know I'm not good enough in android programming, and just started learning GCM but I'm already spend 6h to reading a google, and nothing.

Gracias por cualquier idea.

preguntado el 27 de noviembre de 13 a las 05:11

Whats your issue. Explain it. -

Please post your full logcat error. Also explain what issue you are facing ? -

1 Respuestas

Are you using Eclipse? If Eclipse sees a jar file for compilation, it does not necessarily include it into the apk. (You have to mention the jar in several places, and usually people do not remember in how many places.)

ritht-click on the project name -- build path -- configure build path -- order and export.

The same dialog has a Projects tab, this is where you specify projects you depend on.

If that does not work, put the jar into the libs subdirectory of your project.

respondido 27 nov., 13:06

Thanks, I'm using eclipse. I was missing jar file in my lib folder. Now I got another error, general project error "Your project contains error(s), please fix...". When I unselected in property->Java Build Path->Order and Export Android Private Libraries, then I can run my project, on device it's fine, but on simulator I got warning "Google Play service is not supported by your device." Any ideas why? - Robertas Uldukis

Did somebody know how to fix the error in Android Studio.. I wont see any options like in ecclipse. - lintu

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.