【发布时间】:2015-01-24 08:28:00
【问题描述】:
我正在按照有关创建 Flappy Bird 副本的指南进行操作。 - http://www.kilobolt.com/day-6-adding-graphics---welcome-to-the-necropolis.html
我遇到问题的步骤是从资产目录加载纹理。有作者关于如何执行此操作的说明。
以及他用于实际加载纹理的代码
texture = new Texture(Gdx.files.internal("data/texture.png"));
我的文件结构是这样的(我用的是Android Studio 1.0,作者用的是eclipse)
我必须在资产文件夹中手动创建数据目录。但是,当我尝试运行应用程序时,我得到了这些异常
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: data\texture.png (Internal)
有谁知道问题出在哪里? texture.png 显然位于资产的数据目录中。如作者所述,我还确保在将 .png 文件复制到数据目录后立即清理项目。(以便可以正确加载资源)。问题仅仅是因为使用了两个不同的 IDES,所以必须进行不同的方法调用吗?
【问题讨论】:
标签: android libgdx filenotfoundexception runtimeexception file-not-found