Skip to content
Advertisement

libGDX game complied to superDev on localhost:8080 only shows one button

I am unable to get my libGDX game in the browser using gradlew html:superDev

After executing the command gradlew html:superDev on a terminal inside my IDE (Inteliji), I get the response: The code server is ready at http://127.0.0.1:9876/

I navigate to that site, copy the bookmarks, and when I try to play my game using the website http://localhost:8080/index.html, only a grey reload button appears!

When I click the button, I get a compile option, which does nothing.

After compiling, In the terminal, scrolling up, I see a lot of X can't be instantiated. Constructors not generated and

not emitting code for accessing field mask in class 'com.badlogic.x.x.x' as its of type long which 
can't be used with JSNI
 

(and more) I am really unsure if these are even related to the problem.

I have searched up this question on other sites, but the answers were either not exactly what my problem was, or too vague/didin’t give an example.

What is the problem? Additionally, is there a way to view the log to see what went wrong?

EDIT:

I have looked in the console of the game, and I see the following error:

Uncaught TypeError: $wnd.SoundManager is not a constructor
    at kB_g$ (SoundManager.java:75)
    at VZl_g$.ol_g$ [as onModuleLoad_0_g$] (GwtApplication.java:144)
    at Array.YNi_g$ (max_00046worldofsquares_00046GdxDefinitionSuperdev__EntryMethodHolder.java:3)
    at initializeModules_0_g$ (ModuleUtils.java:44)
    at iZg_g$ (Impl.java:309)
    at lZg_g$ (Impl.java:368)
    at Impl.java:78
    at qNi_g$ (ModuleUtils.java:55)
    at TileType.java:3

When I click on “SoundManager.java.75” it gives me this construstor:

public static native void init (String moduleBaseURL, int flashVersion, boolean preferFlash, SoundManagerCallback callback) /*-{
        $wnd.soundManager = new $wnd.SoundManager(); **< ERROR IS HERE**
        $wnd.soundManager.audioFormats.mp3.required = false;
        $wnd.soundManager.setup({
            url: moduleBaseURL,
            flashVersion: flashVersion,
            preferFlash: preferFlash,
            onready: function() { 
                callback.@com.badlogic.gdx.backends.gwt.soundmanager2.SoundManager.SoundManagerCallback::onready()();
            },
            ontimeout: function(status) {
                callback.@com.badlogic.gdx.backends.gwt.soundmanager2.SoundManager.SoundManagerCallback::ontimeout(Ljava/lang/String;Ljava/lang/String;)(status.success, (typeof status.error === 'undefined') ? '' : status.error.type);
            }
                    
        });
        $wnd.soundManager.beginDelayedInit();
    }-*/;

}

Which is weird, because my game doesn’t even have sounds.

Advertisement

Answer

The problem is related that the latest setup application generates the template files for the snapshot version for libGDX 1.9.12, but you use an older libGDX.

Two ways to resolve this:

  • Use libGDX 1.9.12-SNAPSHOT

or

Bonus quickfix: Deactivate audio in the HTML config.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement