Android Studio中的GDXruntime异常:无法找到资产

时间:2016-04-20 16:46:17

标签: java android android-studio libgdx

我正在使用libgdx在android studio中编写一个飞扬的鸟类游戏,并且它作为桌面应用程序运行良好,但是当我尝试在我的智能手机上运行它时会抛出错误:

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)

我的项目结构如下:

enter image description here

我清理并重建了我的项目,并重新启动了android studio,但这并没有帮助。如何让GDX识别我的资产文件夹?

1 个答案:

答案 0 :(得分:3)

在Android上,文件名区分大小写,因此您需要加载实际文件名playbtn.png,而不是playBtn.png