Reputation: 1
I have problem with that field:
public TextureRegion guiButton = new TextureRegion(new Texture(Gdx.files.local("gui_button.png")));
I packed in assets
folder that image. I build a game, launch and get crash: com.badlogic.gdx.utils.GdxRuntimeException:
Couldn't load file: gui_button.png and more... I unpack an apk
and file was in right place (assets directory) with right name! I really confused by this situation.
Upvotes: 0
Views: 73
Reputation: 19
Like Tenfour04 said: You should almost always use Gdx.files.internal();
to access your resources (textures, sounds, fonts, etc.). Local is mostly used for when you want to write files and later read those files that you've written.
Also, if you're still having problems and you use Eclipse as your IDE you can try this:
Right-click your project > 'Gradle' > 'Refresh Gradle Project.'
You can also try this:
Press the 'Project' header at the top of Eclipse > Press 'Clean...' and then press'OK' in the pop up menu.
Upvotes: 1