GdxRuntimeException:读取包文件时出错:uiskin.atlas

时间:2014-06-17 22:32:23

标签: libgdx

首先,我看到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。感谢

1 个答案:

答案 0 :(得分:0)