1
votes

Using Eclipse IDE

Following the: https://developers.google.com/games/services/android/quickstart

  1. Using the copy of google-play-services_lib (as recommended) and imported as Eclipse project.
  2. Editing the game manifest with:

  3. Adding our APP ID to res/values/strings.xml

  4. Linked google-play-services_lib with our game project and set references in Order and Export tabs in the project settings

  5. In accordance with https://developers.google.com/games/services/android/init using the project BaseGameUtils, from which our activity cannot inherit, because there’s another class already.

  6. So, we moved to the second method without inheriting (see Using GameHelper without BaseGameActivity). We linked google-play-services_lib for BaseGameUtils and set the Library (compilation went down OK).

  7. Linking added to our project to be able to use GameHelper as well as google-play-services_lib.

At this moment SDK from Facebook started causing trouble, so we had to add android-support-v4.jar (used by BaseGameUtils as well) and error during compilation occurs:

Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
All versions of the libraries must be the same at this time.
Versions found are:
Path: /Users/travis/Work/Craneballs/Mafia_android/facebook-android-sdk/facebook/libs/android-support-v4.jar

Path: /Users/travis/Work/Craneballs/Mafia_android/BaseGameUtils/libs/android-support-v4.jar

  • the project can be launched, but crashes on GoogleHelper = new GameHelper(this, GameHelper.CLIENT_ALL) with the error message: java.lang.NoClassDefFoundError: com.google.example.games.basegameutils.GameHelper

I’ve spent many painful hours on this and am at my wits end. Any ideas?

1

1 Answers

0
votes

I was having the same problem.

Here's the solution that fixed it for me:

I had the same issue, I did the following to fix the problem.

  1. Go to "Properties" of the project.
  2. Select "Java Build Path"
  3. Select "Order and Export" Tab
  4. You should see the selected project's "src" and "gen" paths and dependencies here.
  5. The order how they listed were first "src" and then "gen" path
  6. I switch them, so that "gen" folder is build before the "src"

gen - automated code in project (from dependencies and references)

src - source code in project

There was no need to restart the Eclipse. It just started working.

Honestly I have never tried "Android Tools > Fix Project Properties", sometimes it might be doing the same thing. I do not know, I just did above after seen the error message, thinking something is wrong with the build paths.

Resources that might help...

NoClassDefFoundError for code in an Java library on Android

Android app crashes after SDK-tools update version (NoClassDefFound, tool version 22)