3
\$\begingroup\$

I encountered with a little problem. After GWT (and LibGDX) deployment I got an error:

GwtApplication: exception: Couldn't load image '/images/objects.png', file does not exist Couldn't load image '/images/objects.png', file does not exist

This error throws when TextureAtlas tries to load the image from settings.text file:

images/objects.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
hills
rotate: false
xy: 0, 0
size: 1024, 146
orig: 1024, 146
offset: 0, 0
index: -1

I tried to use any type of path

  • "/assets/images/object.png"
  • "/clutchkick/assets/images/object.png"
  • "/public_html/clutchkick/assets/images/object.png"
  • and so on..

Any suggestions?

By the way there are no any problems on android or desktop deployment.

EDIT: The same problem occurs when trying to load a Tmx map.

\$\endgroup\$
5
\$\begingroup\$

There's a bug in com.badlogic.gdx.backends.gwt.GwtFileHandle that adds a slash before the image path in the atlas, but here is a workaround:

Put the atlas files are inside a folder like "assets/images/", don't put it directly in the assets folder, and make sure the image path in atlas file is correct (relative to atlas), then it should work.


Or you can just fix the GwtFileHandle class:

Find this code in com.badlogic.gdx.backends.gwt.GwtFileHandle

public FileHandle child (String name) {
    return new GwtFileHandle(preloader, file + (file.endsWith("/") ? "" : "/") + name, FileType.Internal);
}

And change it to following code

public FileHandle child (String name) {
    return new GwtFileHandle(preloader, file.isEmpty() ? "" : (file + (file.endsWith("/") ? "" : "/")) + name, FileType.Internal);
}
\$\endgroup\$
  • \$\begingroup\$ this bug is still present in 2017, I wasted 2 hours because of it. Thank you! \$\endgroup\$ – Marco Martinelli Dec 22 '17 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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