android - android 上的 Libgdx 无法检测到 GDX 字体

标签 android fonts intellij-idea libgdx

我正在尝试使用 libgdx BitmapFont 呈现简单文本:

 font = new BitmapFont();
 font.draw(batch, "Tap anywhere to begin!", 100, 100);

它在桌面上工作正常,但安卓却报错:

07-30 08:12:35.518: ERROR/AndroidRuntime(817): FATAL EXCEPTION: GLThread 82
        com.badlogic.gdx.utils.GdxRuntimeException: File not found: com/badlogic/gdx/utils/arial-15.fnt (Classpath)
        at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:132)
        at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
        at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:715)
        at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:114)
        at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:73)
        at com.mangokidzee.amphibian.Activity1.create(Activity1.java:23)
        at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:322)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

似乎无法加载字体文件

File not found: com/badlogic/gdx/utils/arial-15.fnt (Classpath)

我使用的是 intelliJ Idea 而不是 Eclipse IDE。我认为这是由于某些路径配置问题但无法弄清楚是什么。有人可以帮帮我吗?

更新

我已经打开了使用 eclipse 创建的示例 libgdx 演示 apk,它在 gdx utils 文件夹中有这些 4 文件

  • arial-15.fnt
  • arial-15.png
  • JsonReader.rl
  • XmlReader.rl

而在我使用 intelliJ 生成的 apk 中,它只有 2 个文件

  • JsonReader.rl
  • XmlReader.rl

arial-15 丢失。

最佳答案

在我从主库目录中删除 gdx-sources.jar 后,一切正常。 也许是 IntelliJ IDEA 的错误?

关于android - android 上的 Libgdx 无法检测到 GDX 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17942194/

相关文章:

android - 获取计步器数据的最佳方式 React Native

android - 在 Android Studio 中单击运行时如何部署签名的 APK?

android - 使用 Retrofit 2 + RxJava 2 接收 Gzip JSON 响应

android - 在 window.open 上获取 ERR_CACHE_MISS

javascript - WebStorm 2018.3 : Unable to write template literal since update

html - 如何使用多个字体覆盖 bootstrap 4 默认字体?

html - 谷歌字体字母高度不一致

c# - C#-与设计有关的配置问题(两个)

Java Selenium 为什么编译器会忽略行?

java - 使用 intellij 和 payara 调试两个独立的 java 服务器应用程序