gpt4 book ai didi

java - com.badlogic.gdx.utils.GdxRuntimeException : Couldn't load file: - Error

转载 作者:行者123 更新时间:2023-11-28 22:00:51 31 4
gpt4 key购买 nike

我正尝试在 libGDX 中为 iOS 开发一个应用程序。

在我的 Java 类中我写了这一行

private Texture texture = new Texture(Gdx.files.internal("data/folder_name_1/folder_name_2/abcd.png"));

我的 robovm.xml 看起来像这样-

<iosInfoPList>Info.plist.xml</iosInfoPList>
<resources>
<resource>
<directory>../android/assets</directory>
<includes>
<include>**</include>
</includes>
<skipPngCrush>true</skipPngCrush>
</resource>
<resource>
<directory>data</directory>
</resource>
</resources>

当我尝试在 iOS 模拟器上运行代码时,它运行良好。但是当我尝试在 iOS 设备(即 iPhone)上运行它时。它会产生一个错误,看起来像这样 -

com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: data/folder_name_1/folder_name_2/abcd.png

有人可以帮我解决这个问题吗?

注意:- 在我的数据文件夹中的 iOS 项目中,有另一个“数据”文件夹,其中有另一个名为“folder_name_1”的文件夹,然后在其中我有“folder_name_2”文件夹,里面有我的 png 文件'abcd.png'。

最佳答案

错误就在你面前......

 <directory>../android/assets</directory>

您要查找的资源不在“数据”文件夹中。它在 android 项目中的“ Assets ”中。

此外,在加载纹理时,您不需要使用 FileHandler.. 这就足够了:

texture = new Texture("image.png");

这将是 android 项目的根( Assets )文件夹

关于java - com.badlogic.gdx.utils.GdxRuntimeException : Couldn't load file: - Error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25138314/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com