2

I'm building libgdx's gdx-invaders sample. There are two projects: gdx-invaders - the base project, which runs as a desktop Java application gdx-invaders-android project - depends on gdx-invaders, and runs as an Android application

I'm new to Eclipse, but based on the best tutorials I could find, took the appropriate steps to get these two projects referencing the appropriate libraries (gdx.jar, etc.), and to get them using Android 2.2. I also tried basic fixes like cleaning before building, and restarting Eclipse.

Now, gdx-invaders builds, but when it runs, I get this runtime exception:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gwt/core/client/GWT
    at com.badlogic.gwtref.client.ReflectionCache.<clinit>(ReflectionCache.java:24)
    at com.badlogic.gdx.utils.reflect.ArrayReflection.newInstance(ArrayReflection.java:11)
    at com.badlogic.gdx.utils.Array.<init>(Array.java:64)
    at com.badlogic.gdx.backends.openal.OpenALAudio.<init>(OpenALAudio.java:51)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:82)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.<init>(LwjglApplication.java:64)
    at com.badlogic.gdxinvaders.GdxInvadersDesktop.main(GdxInvadersDesktop.java:27)

And gdx-invaders-android does not build at all - it is unable to reference package com.badlogic.gdxinvaders (a package which is defined in gdx-invaders), which results in compiler errors when attempting to reference GdxInvaders, a class defined in that package.

The build libraries are from a libgdx-nightly-latest distribution. Do you guys have a preference of whether it's better to copy JARs from here into my base project's lib directory, and reference the JARs here with Add Jars, or whether it's better to use Add External JARS and reference them in the libgdx-nightly-latest directory?

Thanks!! Aaron

Mukesh Kumar Singh
  • 4,512
  • 2
  • 22
  • 30
  • Which version of libgdx are you using? If you're using Eclipse you shouldn't need to manually construct the demo builds. You should just import them, see https://code.google.com/p/libgdx/wiki/SourceRunningDemos – P.T. Sep 25 '13 at 15:03

1 Answers1

2

You have to add gdx project into your project tab which is in java build path. You have to include jpct_ae.jar and jpct_shaders.zip into your project build path.

Nas
  • 2,158
  • 1
  • 21
  • 38