【问题标题】:GdxRuntimeException: Error reading pack file: uiskin.atlasGdxRuntimeException:读取包文件时出错:uiskin.atlas
【发布时间】:2014-06-17 22:32:22
【问题描述】:

首先,我看到了GdxRuntimeException: Couldn't load file,但我认为我在这里遇到了不同的问题。

我正在尝试向屏幕添加皮肤。代码在 Scala 中。

val skin = new Skin(Gdx.files.internal("uiskin.json"))

我使用 libGdx 1.1.0。 uiskin.json 来自LibGdx's Github repo。 以下是错误:

com.badlogic.gdx.utils.GdxRuntimeException: Error reading pack file: uiskin.atlas
    at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:187)
    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:231)
    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:226)
    at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:216)
    at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:69)
    at com.pt2121.skintest.HelpScreen.show(HelpScreen.scala:39)
    at com.badlogic.gdx.Game.setScreen(Game.java:61)
    at com.pt2121.skintest.SkinTest.create(SkinTest.scala:8)
    at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:236)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1512)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
 Caused by: java.lang.NullPointerException
    at java.lang.Enum$1.create(Enum.java:43)
    at java.lang.Enum$1.create(Enum.java:35)
    at libcore.util.BasicLruCache.get(BasicLruCache.java:54)
    at java.lang.Enum.getSharedConstants(Enum.java:209)
    at java.lang.Enum.valueOf(Enum.java:189)
    at com.badlogic.gdx.graphics.Pixmap$Format.valueOf(Pixmap.java:49)
    at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:120)
    ... 10 more

我已经找了好几个小时了。我想这可能与 Scala 或 libGdx 版本有关。 (我在 JAVA 中使用 libGdx 0.99 编写了几乎相同的代码,并且运行良好。) 我的项目在https://github.com/prt2121/skintest。谢谢

【问题讨论】:

    标签: libgdx


    【解决方案1】:

    请更新您的 libgdx github 存储库,之后它应该可以正常工作。 看看这个:Why "No com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle registered with name: default" error is coming and how to fix it?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-01
      • 2012-09-12
      • 1970-01-01
      相关资源
      最近更新 更多