2014-06-17 134 views
0

首先,我看到了GdxRuntimeException: Couldn't load file,但我認爲我在這裏有不同的問題。GdxRuntimeException:讀取包文件時出錯:uiskin.atlas

我正試圖添加一個皮膚到屏幕上。代碼在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。謝謝

回答