gpt4 book ai didi

java - 使用 libgdx 的默认皮肤 .. SerializationException : Error reading file: ui/uiskin. json

转载 作者:行者123 更新时间:2023-12-01 11:20:08 24 4
gpt4 key购买 nike

我正在尝试运行 LibGDX 项目的桌面版本,但出现以下错误..

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:97)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.<init>(Skin.java:74)
at com.mygdx.game.MainMenu.show(MainMenu.java:51)
at com.badlogic.gdx.Game.setScreen(Game.java:61)
at com.mygdx.game.Splash$1.run(Splash.java:48)
at com.badlogic.gdx.scenes.scene2d.actions.RunnableAction.run(RunnableAction.java:42)
at com.badlogic.gdx.scenes.scene2d.actions.RunnableAction.act(RunnableAction.java:32)
at com.badlogic.gdx.scenes.scene2d.actions.SequenceAction.act(SequenceAction.java:65)
at com.badlogic.gdx.scenes.scene2d.Actor.act(Actor.java:95)
at com.badlogic.gdx.scenes.scene2d.Group.act(Group.java:49)
at com.badlogic.gdx.scenes.scene2d.Stage.act(Stage.java:223)
at com.badlogic.gdx.scenes.scene2d.Stage.act(Stage.java:186)
at com.mygdx.game.Splash.render(Splash.java:29)
at com.badlogic.gdx.Game.render(Game.java:46)
at com.mygdx.game.ColorCatch.render(ColorCatch.java:19)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: com.badlogic.gdx.utils.SerializationException: Error reading file: ui/uiskin.json
at com.badlogic.gdx.utils.Json.fromJson(Json.java:683)
at com.badlogic.gdx.scenes.scene2d.ui.Skin.load(Skin.java:95)
... 16 more
Caused by: com.badlogic.gdx.utils.SerializationException:
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:416)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:410)
at com.badlogic.gdx.utils.Json.readValue(Json.java:867)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$1.readValue(Skin.java:404)
at com.badlogic.gdx.utils.Json.fromJson(Json.java:681)
... 17 more
Caused by: com.badlogic.gdx.utils.reflect.ReflectionException: Class not found: com.badlogic.gdx.scenes.scene2d.ui.Tooltip$TooltipStyle
at com.badlogic.gdx.utils.reflect.ClassReflection.forName(ClassReflection.java:30)
at com.badlogic.gdx.scenes.scene2d.ui.Skin$2.read(Skin.java:414)
... 21 more
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.scenes.scene2d.ui.Tooltip$TooltipStyle
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:191)
at com.badlogic.gdx.utils.reflect.ClassReflection.forName(ClassReflection.java:28)

项目结构如下..

rob@work:~/git/test$ ls
android core gradle gradlew ios local.properties
build.gradle desktop gradle.properties gradlew.bat libs settings.gradle
rob@work:~/git/test$ ls android/assets/ui/
default.fnt uiskin.atlas uiskin.json uiskin.png

MainMenu 的简化版本 ..

public class MainMenu implements Screen {

private Stage stage = new Stage();
private TextureAtlas atlas;
private Skin skin;
private Button quit;

public MainMenu() {}

@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

stage.act(delta);
stage.draw();
}

@Override
public void show() {

atlas = new TextureAtlas("ui/uiskin.atlas");
skin = new Skin(Gdx.files.internal("ui/uiskin.json"));
skin.addRegions(atlas);
}

@Override
public void resize(int width, int height) {

TextButtonStyle styleQuit = new TextButtonStyle();
styleQuit.up = skin.getDrawable("8layer");
}
}

最佳答案

您是否将 libgdx 更新到版本 1.6.4?刚刚添加了工具提示软件,如果您的皮肤文件缺少它们,则会崩溃。检查 libgdx 存储库中的测试,看看它是什么样子的。

关于java - 使用 libgdx 的默认皮肤 .. SerializationException : Error reading file: ui/uiskin. json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31346142/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com