2
\$\begingroup\$

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.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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? \$\endgroup\$
    – Blue
    Commented Mar 21, 2012 at 14:13
  • \$\begingroup\$ The video linked to from the main google code page discusses this at 7mins 8 secs: youtu.be/vLx_72qxK_0?t=7m8s \$\endgroup\$ Commented Mar 21, 2012 at 22:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .