1

I am trying to compile the libGDX project using GWT (libgdx-project-html right click -> Google -> GWT Compile).

I get no errors while compiling except

com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Target java.lang.StringIndexOutOfBoundsException

but since I'm not using this util should not be a problem.

After the compilation says that it was successful, I ran the local hosted site.

LibGDX logo and loading bar come up (fine until here), and when they are done, I get a black game screen and a box below it with unlimited

GwtApplication: exception: (TypeError) : Cannot call method 'nullMethod' of null (TypeError) : Cannot call method 'nullMethod' of null

message lines.

In the console the following message is repeated continuously:

Uncaught java.lang.RuntimeException: com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot call method 'nullMethod' of null (anonymous function) 597957B2399D3903739C615799AE1A15.cache.html:11899

The project basically is nothing but the logo of libGDX that should come up and fill the game screen (the default one) and no code has been modified.

Some additional notes:

Desktop and Android compile and work flawlessly.

Console says SoundManager 2 loaded (OK) before that error message comes up.

Strict flag is set when GWT compiling and everything are compiled with no errors.

harrane
  • 959
  • 11
  • 24

1 Answers1

3

For anyone having the same problem or any other similar/weird exceptions.

Make sure that strict flag is set by adding

-strict

in the compiling arguments and most importantly, you are using

GL20

as WebGL is based on GL20 and doesn't support GL10.

harrane
  • 959
  • 11
  • 24
  • I was having a similar issue. I found a couple places in the obfuscated code this: null.Fc() I removed it and then the game would run fine. I then recompiled with GWT with output style set to 'detailed' hoping that I could find the source of the problem. After recompile the problem disappeared. It should also be noted that no OpenGL configuration is needed in the HTML project since only GL20 is supported by WebGL. I assume you meant. – dreamwagon Feb 16 '14 at 21:17