Search code examples
javaandroidgoogle-play-servicesgoogle-play-games

ClassDefNotFound Error with Google BaseGameUtils GameHelper


I don't know whats happening, but for some reason i always get a ClassDefNotFound Error when i try to add Google BaseGameUtils to my app project. I did all the steps from the Google Developer website, but still getting the ClassDefNotFound execption on GameHelper:

public GameHelper getGameHelper() {
    if (mHelper == null) {
        mHelper = new GameHelper(this, mRequestedClients);
        mHelper.enableDebugLog(mDebugLog);
    }
    return mHelper;
}

@Override
protected void onCreate(Bundle b) {
    super.onCreate(b);
    if (mHelper == null) {
        getGameHelper();
    }
    mHelper.setup(this);
}

The line mHelper = new GameHelper(this. mRequestedClients); throws the class exception.

I tried everything:

  • I tried preject cleaning
  • I tried export order
  • I checked every library

I don't know what i should try or do. BTW i am using eclipse as IDE and the latest ADT and BuildTools. My SDK and play services lib are also the latest version.

LogCat Error:

11-04 22:01:03.211: E/AndroidRuntime(19057): FATAL EXCEPTION: main
11-04 22:01:03.211: E/AndroidRuntime(19057): java.lang.NoClassDefFoundError: com.google.example.games.basegameutils.GameHelper
11-04 22:01:03.211: E/AndroidRuntime(19057):    at com.google.example.games.basegameutils.BaseGameActivity.getGameHelper(BaseGameActivity.java:77)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at com.google.example.games.basegameutils.BaseGameActivity.onCreate(BaseGameActivity.java:87)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at com.pi.rtest.MainActivity.onCreate(MainActivity.java:24)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.app.Activity.performCreate(Activity.java:5250)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2297)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.app.ActivityThread.access$700(ActivityThread.java:152)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.os.Handler.dispatchMessage(Handler.java:99)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.os.Looper.loop(Looper.java:137)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at android.app.ActivityThread.main(ActivityThread.java:5328)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at java.lang.reflect.Method.invokeNative(Native Method)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at java.lang.reflect.Method.invoke(Method.java:511)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
11-04 22:01:03.211: E/AndroidRuntime(19057):    at dalvik.system.NativeStart.main(Native Method)

Solution

  • Okay, i fixed it by replaceing my eclipse version with a newer one. I don't know why this happened, but after updating everything else, this seemed like the only left thing and it worked.