Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

How to save file in assets so it can be properly loaded in Android Studio?

$
0
0

I am following a guide on creating a replica of Flappy Bird. – http://www.kilobolt.com/day-6-adding-graphics—welcome-to-the-necropolis.html

The step I am having trouble is loading the texture from the assets directory. There are the author’s instructions on how to do this.
enter image description here

And the code that he uses to actually load the texture

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

My file structure looks like this(I am using Android Studio 1.0 while the author is using eclipse) enter image description here

I had to manually create the data directory inside the assets folder. However when I try to run the application, I get these exceptions

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: data/texture.png
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: datatexture.png (Internal)

Does anyone know what the issue is? The texture.png is clearly inside the data directory of assets. I also made sure to clean the project right after copying the .png file into the data directory as the author mentioned.(so resources can be properly loaded). Is the issue just that were using two different IDES, so that different method calls have to be made?


Viewing all articles
Browse latest Browse all 434

Trending Articles