akonsu
akonsu

Reputation: 29538

libgdx: android application cannot find the main game class

I have created the three projects as described in http://code.google.com/p/libgdx/wiki/ProjectSetup, and running the desktop version works, but I am getting the error below when I run the android version on the emulator. The main project is in the build path of the android project and eclipse builds everything with no errors. what am I missing?

10-31 07:06:47.023: E/dalvikvm(769): Could not find class 'com.mygame.MyGame',
referenced from method com.mygame.MyGameAndroid.onCreate

Upvotes: 4

Views: 4694

Answers (3)

Mihaita Tinta
Mihaita Tinta

Reputation: 1

In had to check the radio button in the android project properties->Java Build Path-> Order and Export-> main game project. Hope it helps anyone else.

Upvotes: -1

ashes999
ashes999

Reputation: 10163

In my case, this happened because my core Game class derived from a framework Game class. The framework class wasn't properly included; since the subclass couldn't be found, Android reported that the main class couldn't be found (since it wasn't fully known).

To solve this, I correctly added my derived framework reference, and everything worked.

Upvotes: 0

akonsu
akonsu

Reputation: 29538

I have resolved this when I switched the Java compiler for the main project from JavaSE-1.7 to JavaSE-1.6. Do now know why this did not work with JavaSE-1.7. Would appreciate any comments on that.

EDIT: a related post: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=2314

Upvotes: 9

Related Questions