Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

So I was searching for different ways that could suit me in programming and came across LibGDX. Naturally I looked at the tutorial. As I was doing it, I was following the steps word for word, except naming the classes. In the end, I was able to create the desktop launcher for the game but not the android launcher.

The following error is my error: Cannot instantiate the type Game (Game is the name of the class)

I got the tutorial from http://steigert.blogspot.com.au/2012/02/1-libgdx-tutorial-introduction.html The link in the tutorial is the original but it uses jogl instead of lwjgl.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

From the wiki: http://code.google.com/p/libgdx/wiki/ProjectSetup

Note: The folder really must be called "libs", a naming convention forced on us by the Android Eclipse plugin.

Without this, your code will still compile within Eclipse, because it is compiling against gdx.jar from the (referenced), desktop project, but won't run on an Android device because gdx.jar wasn't in the libs dir. Although I too have come across (and enjoyed) the tutorials you pointed to, it seems like this point was missed.

share|improve this answer
    
I think i know the problem but i dont know how to fix it, the code can be fixed if the name of the file is within the same project. I selected a build path from the Android one to the Desktop one. But it still wouldn't work. What did i do wrong? –  Blue Mar 21 '12 at 14:13
    
The video linked to from the main google code page discusses this at 7mins 8 secs: youtu.be/vLx_72qxK_0?t=7m8s –  Peter Serwylo Mar 21 '12 at 22:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.