Eugen
Eugen

Reputation: 155

Android - Libgdx - Couldnt Load File

I have used google, read all Questions here on StackExchange but still couldnt solve my Problem.

So Im following a tutorial from kilobolt(Zombie Bird).

The desktop-version of the game is running without problems, but if I want to run it on an android emulator I get this error message:

"Couldn't load file: data/logo.png"

The line where I get the error looks like this:

logoTexture = new Texture(Gdx.files.internal("data/logo.png"));

My Android Path looks like this:

-Android -Assets -Data -logo.png

I assume this is the correct path.

I have tried cleaning the project, I used Gradle > Refresh All, I restarted Eclipse. Nothing worked.

Im a little bit confused cause if I move the file outside of Data but in the Assets Folder and change the path to this:

logoTexture = new Texture(Gdx.files.internal("logo.png"));

It works.

Can someone explain me why I cant use the Data Folder inside of Assets?

Upvotes: 0

Views: 240

Answers (2)

Martin Pfeffer
Martin Pfeffer

Reputation: 12627

maybe it's caused by the difference of OpenGl ES 1 and OpenGl ES 2...

Using OpenGl ES 1 the picture size has the power of two. Bear with me - I'm new to libgdx.. :)

Upvotes: 0

EpicPandaForce
EpicPandaForce

Reputation: 81539

What emulator are you using to run it? For me, the same code works properly on an actual Android device, so I'd assume it is an Emulator error. Possibly has to do with the / as the seperator character. This is just a wild guess, but does

logoTexture = new Texture(Gdx.files.internal("data" + File.separator + "logo.png"));

fix it, or break it?

Upvotes: 1

Related Questions