Reputation:
I'm writing a flappy bird game in android studio using libgdx, and it runs fine as a desktop application, but when I try to run it on my smartphone it throws an error:
E/AndroidRuntime: FATAL EXCEPTION: GLThread 73772
com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: playBtn.png
at com.badlogic.gdx.graphics.Pixmap.<init>(Pixmap.java:148)
at com.badlogic.gdx.graphics.TextureData$Factory.loadFromFile(TextureData.java:98)
t com.badlogic.gdx.graphics.Texture.<init>(Texture.java:100)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:92)
at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:88)
at com.lii2.game.states.MenuState.<init>(MenuState.java:20)
at com.lii2.game.FlappyDemo.create(FlappyDemo.java:33)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:290)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
My project structure looks like this:
I cleaned and rebuilt my project, and restarted android studio, but that didn't help. How do I get GDX to recognize my assets folder?
Upvotes: 1
Views: 93
Reputation: 93902
On Android, file names are case sensitive, so you need to load the actual file name playbtn.png
, not playBtn.png
.
Upvotes: 2