[GDX LOADER] JSON path for images

General discussion about the R.U.B.E editor
Post Reply
coalacorey
Posts: 1
Joined: Wed Oct 29, 2014 9:29 pm

[GDX LOADER] JSON path for images

Post by coalacorey »

I am using the gdx loader for eclipse and did set up a asset manager like on the github repo but the manager is not able to find the files (images) from my created .json file.

Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file:
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading file:
Caused by: java.io.FileNotFoundException:

These are the three error messenges I get when I try to run my program.
The file path I chose (for my images in R.U.B.E.) is: C:\Users\xxx\Desktop\Android\Applications\AirHockey\Assets\xxx.png

Do I have to change the path afterwards? My images are located in the assets folder with the json file but whatever path I tried I couldn't get it to load the scene.

I really hope you can help me out on this one.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: [GDX LOADER] JSON path for images

Post by iforce2d »

Do you mean that the paths of the images are saved as "C:\Users\xxx\..." in the .json file? Naturally that will not work, because that path does not exist on Android.

If this is the case, then you need to save using relative paths instead. In the Scene settings dialog under the Export options tab, you should uncheck the "Save full path for images" checkbox. That will make the image paths relative to the exported .json file. However, for Android that's probably not what you want either, because Android will look for the images inside the resources folder of the app bundle. You will most likely need to also specify the path to use as the base path when calculating the relative path for the images. See the Export options topic in the built-in help for a full description with an example (try searching in the help for "relative path methods" should find it). Be sure to read the tool-tips for the options in the dialog too.
Post Reply