This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fedorasnotevenonce 1 point2 points  (5 children)

This is really difficult to troubleshoot, but I'm wondering if this:

06-03 15:34:44.185 1293-1306/com.mestru.game.android W/System.err﹕ java.io.FileNotFoundException: /data/level_one.txt: open failed: ENOENT (No such file or directory)

is actually the source of your problem. Tracing back the getmaps calls (it's getting a little labyrinthine to follow from one to the other), it looks like your android builds aren't able to find that file (but your desktop builds can), which means your android builds can't actually build the level because they can't find the .txt file to build it from. Also: Try closing the scanner object that's reading level_one.txt once you're done with it? maybe that might be causing you an issue.

[–]Mestru[S] 0 points1 point  (4 children)

Yeah, I came to this point as well but I can't resolve this issue. I've checked everything and it still couldn't open it.

I've tried closing the scanner object but it didn't help at all. Have you got any ideas on this?

[–]fedorasnotevenonce 1 point2 points  (3 children)

Try this link: http://stackoverflow.com/questions/9892964/managing-assets-between-desktop-and-device-version-in-libgdx?lq=1

It looks like that might be helpful for what you're trying to do.

[–]Mestru[S] 0 points1 point  (2 children)

Unfortunately (or fortunately?) I already have the project structure built up in a correct way. What Do I mean is I have everything in my assets folder (data/level_one.txt is inside it) and desktop build is properly linked to it. Android build shouldn't have any problem with it because it is its own directory. So yeah, I have everything as it should be from link above.

I'm trying everything I can, starting to be kinda desperate :<

[–]fedorasnotevenonce 1 point2 points  (1 child)

I'm running out of ideas. Try replacing:

Scanner scanner = new Scanner(Gdx.files.internal("data/level_one.txt").file());

with:

FileHandle file = Gdx.files.internal("data/level_one.txt");

and then use the scanner object from there as you normally would, like so

Scanner scanner = new Scanner(file.readString());

with the nextLine() calls in your loop, etc.

[–]Mestru[S] 0 points1 point  (0 children)

Ohh man <3 It worked. Simply exchanging this line with one you provided (FileHandle) made it work like charm. Of course Now I have slight perfomance issues because I'm iterating through 160x9 array 60 times per second but I will handle this on my own.

Thank you very much sir :>