kotcrab / vis-ui

libGDX UI toolkit
Apache License 2.0
727 stars 128 forks source link

VisUI cannot be loaded twice EVEN when checking to see if it's been loaded #297

Closed fmmarzoa closed 6 years ago

fmmarzoa commented 6 years ago

Using libGDX 1.9.9-SNAPSHOT and VisUI 1.4.2-SNAPSHOT

Getting a crash like this:

com.badlogic.gdx.utils.GdxRuntimeException: VisUI cannot be loaded twice

In spite that:

a) It's the first time the library is being loaded and b) There's a check in place to avoid this.

        if (! VisUI.isLoaded())
            if (DirectedGame.getDeviceResolution() > 480) {
                VisUI.load(VisUI.SkinScale.X2);
            } else
                VisUI.load();

This only happens with the signed release apk. If I build a debug apk instead, it seems to work just fine.

kotcrab commented 6 years ago

Not sure what is going on here but given how it only happens with release build you will probably need to tweak proguard rules. Like I said in https://github.com/kotcrab/vis-editor/issues/296:

You will probably want to disable proguard for VisUI and libgdx classes. At the very least you will need to add rules to skip Skin and UI styles classes because they are instantiated through reflection after loading skin json.

fmmarzoa commented 6 years ago

I had already added some proguard rules regarding VisUI and libGDX, but maybe I didn't hit the bulls eye. Anyway I only needed it to show a confirmation dialog and I was in a rush, so I ended up doing it by myself.

Bests!

kotcrab commented 6 years ago

I'm going to close this then. As far as I can tell there is nothing that can be done on VisUI side to improve this.