-1

When i run this LibGdx code on IntelliJ using The DesktopLaucher its fine. But when i run it into my Android via USB the app crash.

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();
    }
}

I Also have an Json file added:

{
    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
        }
    }
}

I took that last part from The Libgdx(GitHub ´i think´) and a tutorial

  • 3
    Can you post the crash details? – TheoKanning Feb 09 '16 at 17:40
  • To see if a JSON is valid use [JSONLint](http://jsonlint.com/), and you'll see this JSON is not correct. – Skizo-ozᴉʞS Feb 09 '16 at 17:58
  • ´cricket_007´ : I said that i have a Json file not that was written in json xD && ´TheoKanning´ : Sorry but there were no "Errors" displayed, when i open it the app just closes after saying that (Stopped Responding) an then i just click ok on android. – user5895975 Feb 09 '16 at 18:05
  • Yes, the device says "stopped responding", but that is the message for any app that crashes there this is something called a logcat that is generated containing the **reason** for the crash – OneCricketeer Feb 09 '16 at 18:16
  • [How to get Android crash logs?](http://stackoverflow.com/questions/3643395/how-to-get-android-crash-logs) – OneCricketeer Feb 09 '16 at 18:18

1 Answers1

0

I found out, I downloaded the files uiskin.png and uiskin.atlas from libgdx-master.zip

https://github.com/libgdx/libgdx/tree/master/tests/gdx-tests-android/assets/data

Looks like the android version need some more components to run that app!

Hopefully this will work as well for other people. -Sry for my newbieness :)