As stated in the title, I'm getting the error reading file ui/uiskin.json
when running the app on the android emulator only, otherwise it runs fine on the desktop launcher.
So far I have tried restarting android studio and ensuring com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle
: wasn't present in the json file but neither of those have worked.
Any suggestion will be appreciated as I am clueless.
This seems to only occur on the android emulator when using textFields that use that skin on my menu screen which is odd as im only using the default uiskins provided by LIBGDX tools.
First I will show you The Line of code in question (as stated on line 58) will be just below followed by the JSON file second followed by the full error report third:
the line of code in question:
skin = new Skin(Gdx.files.internal("ui/uiskin.json"));
and the JSON file looks like this:
{
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } },
com.badlogic.gdx.graphics.Color:
{
green: { a: 1, b: 0, g: 1, r: 0 },
white: { a: 1, b: 1, g: 1, r: 1 },
red: { a: 1, b: 0, g: 0, r: 1 },
black: { a: 1, b: 0, g: 0, r: 0 }
},
com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } }
},
com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
default: { down: default-round-down, up: default-round },
toggle: { down: default-round-down, checked: default-round-down, up: default-round }
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: { down: default-round-down, up: default-round, font: default-font, fontColor: white
},
toggle: { down: default-round-down, up: default-round, checked: default-round-down, font:
default-font, fontColor: white, downFontColor: red }
},
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle: {
default: { vScroll: default-scroll, hScrollKnob: default-round-large, background: default-
rect, hScroll: default-scroll, vScrollKnob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle: {
default: {
font: default-font, fontColor: white, background: default-select,
scrollStyle: default,
listStyle: { font: default-font, selection: default-select-selection }
}
},
com.badlogic.gdx.scenes.scene2d.ui.SplitPane$SplitPaneStyle: {
default-vertical: { handle: default-splitpane-vertical },
default-horizontal: { handle: default-splitpane }
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
default: { titleFont: default-font, background: default-window, titleFontColor: white },
dialog: { titleFont: default-font, background: default-window, titleFontColor: white,
stageBackground: dialogDim }
},
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
default-horizontal: { background: default-slider, knob: default-slider-knob }
},
com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle: {
default: { font: default-font, fontColor: white }
},
com.badlogic.gdx.scenes.scene2d.ui.TextField$TextFieldStyle: {
default: { selection: selection, background: textfield, font: default-font, fontColor: white,
cursor: cursor }
},
com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
default: { checkboxOn: check-on, checkboxOff: check-off, font: default-font, fontColor: white
}
},
com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle: {
default: { fontColorUnselected: white, selection: selection, fontColorSelected: white, font:
default-font }
},
com.badlogic.gdx.scenes.scene2d.ui.Touchpad$TouchpadStyle: {
default: { background: default-pane, knob: default-round-large }
},
com.badlogic.gdx.scenes.scene2d.ui.Tree$TreeStyle: {
default: { minus: tree-minus, plus: tree-plus, selection: default-select-selection }
}
}
- and here is the full error report:
E/AndroidRuntime: FATAL EXCEPTION: GLThread 2341
Process: com.mygdx.game, PID: 842
com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:106)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:83)
at com.mygdx.game.scenes.MenuUI.<init>(MenuUI.java:58)
at com.mygdx.game.screens.MainMenu.<init>(MainMenu.java:41)
at com.mygdx.game.MyGdxGame.create(MyGdxGame.java:24)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:281)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)
Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json
at com.badlogic.gdx.utils.Json.fromJson(Json.java:803)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:104)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:83)
at com.mygdx.game.scenes.MenuUI.<init>(MenuUI.java:58)
at com.mygdx.game.screens.MainMenu.<init>(MainMenu.java:41)
at com.mygdx.game.MyGdxGame.create(MyGdxGame.java:24)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:281)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)
Caused by: com.badlogic.gdx.utils.SerializationException: Font file not found: default.fnt
at com.badlogic.gdx.scenes.scene2d.ui.Skin$3.read(Skin.java:541)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$3.read(Skin.java:532)
at com.badlogic.gdx.utils.Json.readValue(Json.java:1006)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:469)
at com.badlogic.gdx.utils.Json.readValue(Json.java:972)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.readNamedObjects(Skin.java:518)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:507)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:501)
at com.badlogic.gdx.utils.Json.readValue(Json.java:1006)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:469)
at com.badlogic.gdx.utils.Json.fromJson(Json.java:801)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:104)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:83)
at com.mygdx.game.scenes.MenuUI.<init>(MenuUI.java:58)
at com.mygdx.game.screens.MainMenu.<init>(MainMenu.java:41)
at com.mygdx.game.MyGdxGame.create(MyGdxGame.java:24)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:281)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1557)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)