【发布时间】:2016-05-19 19:43:33
【问题描述】:
当我使用 DesktopLaucher 在 IntelliJ 上运行这个 LibGdx 代码时,它很好。 但是当我通过 USB 将它运行到我的 Android 中时,应用程序崩溃了。
public class GraphicInterface extends ApplicationAdapter {
private Stage Graphs;
Camera screen = new OrthographicCamera();
public Skin skin;
@Override
public void create () {
skin = new Skin(Gdx.files.internal("uiskin.json"));
Graphs = new Stage(new ScreenViewport());
final TextButton button1 = new TextButton("Click me", skin,"default");
button1.setWidth(200f);
button1.setHeight(50f);
final Dialog texto = new Dialog("Click Message", skin);
button1.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y){
texto.show(Graphs);
Timer.schedule(new Timer.Task(){
@Override
public void run() {
texto.hide();
}
},5);
}
});
Graphs.addActor(button1);
Gdx.input.setInputProcessor(Graphs);
}
@Override
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
Graphs.act(Gdx.graphics.getDeltaTime());
Graphs.draw();
}
}
我还添加了一个 Json 文件:
{
com.badlogic.gdx.graphics.g2d.BitmapFont: {
default-font: {
file: Razer.fnt
}
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: {
down: default-round-down,
up: default-round,
font: default-font
},
},
com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: {
default: {
titleFont: default-font
}
}
}
我从 The Libgdx(GitHub 'i think') 和一个教程中获取了最后一部分
【问题讨论】:
-
你能发布崩溃细节吗?
-
要查看 JSON 是否有效,请使用 JSONLint,您会看到此 JSON 不正确。
-
´cricket_007´:我说我有一个不是用 json xD && 'TheoKanning' 编写的 Json 文件:抱歉,当我打开它时,没有显示“错误”,应用程序刚刚关闭说完(停止响应)然后我在android上点击确定。
-
是的,设备说“停止响应”,但这是任何应用程序崩溃的消息,这是一个名为 logcat 的东西,其中包含 原因崩溃
标签: java android json intellij-idea