Du bist nicht angemeldet.

Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!

Werbeanzeige

1

24.08.2014, 15:44

[getAttribValue] Bad attribute idx in AndroidStudio

Hallo zusammen,
ich bin libgdx Einsteiger und versuche Grad meine erste app zum laufen zu bringen. Ich habe das Setup Tool von Badlogicgames verwendet um das Projekt zu erstellen und meine Main Klasse des Coremoduls als erstes auf ein Startscreen verwiesen:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package de.kakarott.bottlecollector;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;



public class TheGame extends Game {
    private int lastScore;
    
    @Override
    public void create () {
        Gdx.app.log("thegame","create");
        showStartScreen();
    }

    @Override
    public void render () {
    }

    private void showStartScreen(){
        setScreen(new StartScreen(lastScore,new InputListener() {
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
                getScreen().dispose();
                Gdx.app.log("thegame","clicked start");
                startGame();
                return true;
            }
        }));
    }

    private void startGame() {

    }
}



und Startscreenklasse:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package de.kakarott.bottlecollector;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.viewport.StretchViewport;

/**
 * Created by ahmet on 18.08.14.
 */
public class StartScreen implements Screen {

    private final Button buttonStart;
    private Stage stage;
    private InputListener listener;

    public StartScreen(int lastScore, InputListener listener){
        super();
        this.listener = listener;

        stage = new Stage();
        Gdx.input.setInputProcessor(stage);

        Table table = new Table();
        table.setFillParent(true);

        Label.LabelStyle skin = new Label.LabelStyle();
        skin.font = new BitmapFont
                (Gdx.files.internal("plaincred.fnt"),Gdx.files.internal("plaincred.png"),false);

        Button.ButtonStyle buttonStyle = new Button.ButtonStyle();
        buttonStyle.up = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("start.png"))));

        String formatted = String.format("%07d",lastScore);
        Label labelScore = new Label(formatted,skin);
        table.add(labelScore).center();
        table.row();

        Image imageLogo = new Image();
        imageLogo.setDrawable
                (new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("logo.png")))));
        table.add(imageLogo).expand().fillX();
        table.row();

        buttonStart = new Button(buttonStyle);
        buttonStart.addListener(listener);
        table.add(buttonStart).center().padBottom(50);

        stage.addActor(table);

        table.debug();

    }


    @Override
    public void render(float delta) {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

    @Override
    public void resize(int width, int height) {
        stage = new Stage(new StretchViewport(width,height));
    }

    @Override
    public void show() {

    }

    @Override
    public void hide() {

    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void dispose() {
        buttonStart.removeListener(listener);
        stage.dispose();
        Gdx.app.log("startscreen","dispose");
    }
}


Wenn ich den code nun im Emulator starten will bleibt der Bildschirm schwarz, logcat gibt mir folgenden Fehler zurück:

08-24 09:28:26.041 1643-1643/de.kakarott.bottlecollector.android D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
08-24 09:28:26.461 1643-1643/de.kakarott.bottlecollector.android D/dalvikvm﹕ Trying to load lib /data/app-lib/de.kakarott.bottlecollector.android-1/libgdx.so 0xb201b3f0
08-24 09:28:26.461 1643-1643/de.kakarott.bottlecollector.android D/dalvikvm﹕ Added shared lib /data/app-lib/de.kakarott.bottlecollector.android-1/libgdx.so 0xb201b3f0
08-24 09:28:26.461 1643-1643/de.kakarott.bottlecollector.android D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/de.kakarott.bottlecollector.android-1/libgdx.so 0xb201b3f0, skipping init
08-24 09:28:26.521 1643-1643/de.kakarott.bottlecollector.android D/﹕ HostConnection::get() New Host Connection established 0xb8485620, tid 1643
08-24 09:28:27.271 1643-1643/de.kakarott.bottlecollector.android I/AndroidInput﹕ sensor listener setup
08-24 09:28:27.591 1643-1643/de.kakarott.bottlecollector.android W/EGL_emulation﹕ eglSurfaceAttrib not implemented
08-24 09:28:27.611 1643-1643/de.kakarott.bottlecollector.android D/OpenGLRenderer﹕ Enabling debug mode 0
08-24 09:28:27.691 1643-1660/de.kakarott.bottlecollector.android D/﹕ HostConnection::get() New Host Connection established 0xb85d8ea0, tid 1660
08-24 09:28:27.711 1643-1660/de.kakarott.bottlecollector.android W/GL2JNIView﹕ creating OpenGL ES 2.0 context
08-24 09:28:27.771 1643-1660/de.kakarott.bottlecollector.android D/dalvikvm﹕ Trying to load lib /data/app-lib/de.kakarott.bottlecollector.android-1/libgdx.so 0xb201b3f0
08-24 09:28:27.781 1643-1660/de.kakarott.bottlecollector.android D/dalvikvm﹕ Shared lib '/data/app-lib/de.kakarott.bottlecollector.android-1/libgdx.so' already loaded in same CL 0xb201b3f0
08-24 09:28:27.801 1643-1660/de.kakarott.bottlecollector.android I/GL2﹕ all initialized 2
08-24 09:28:27.831 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ OGL renderer: Android Emulator OpenGL ES Translator (Mesa DRI Intel(R) Haswell Mobile )
08-24 09:28:27.831 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ OGL vendor: Google (Intel Open Source Technology Center)
08-24 09:28:27.831 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ OGL version: OpenGL ES 2.0 (3.0 Mesa 9.2.1)
08-24 09:28:27.831 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ OGL extensions: GL_EXT_debug_marker GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float
08-24 09:28:27.831 1643-1660/de.kakarott.bottlecollector.android E/EGL_emulation﹕ [getAttribValue] Bad attribute idx
08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android E/EGL_emulation﹕ tid 1660: eglGetConfigAttrib(605): error 0x3004 (EGL_BAD_ATTRIBUTE)
08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android E/EGL_emulation﹕ [getAttribValue] Bad attribute idx
08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android E/EGL_emulation﹕ tid 1660: eglGetConfigAttrib(605): error 0x3004 (EGL_BAD_ATTRIBUTE)

08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ framebuffer: (5, 6, 5, 0)
08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ depthbuffer: (16)
08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ stencilbuffer: (0)
08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ samples: (0)
08-24 09:28:27.841 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ coverage sampling: (false)
08-24 09:28:27.861 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ Managed meshes/app: { }
08-24 09:28:27.901 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ Managed textures/app: { }
08-24 09:28:27.901 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ Managed shaders/app: { }
08-24 09:28:27.901 1643-1660/de.kakarott.bottlecollector.android I/AndroidGraphics﹕ Managed buffers/app: { }
08-24 09:28:27.921 1643-1660/de.kakarott.bottlecollector.android I/thegame﹕ create
08-24 09:28:28.621 1643-1660/de.kakarott.bottlecollector.android D/dalvikvm﹕ GC_FOR_ALLOC freed 268K, 11% free 2897K/3224K, paused 35ms, total 41ms
08-24 09:28:29.161 1643-1660/de.kakarott.bottlecollector.android D/dalvikvm﹕ GC_FOR_ALLOC freed 161K, 12% free 3003K/3408K, paused 45ms, total 53ms

Auf google hab ich bereits gesucht aber mein englisch lässt leider zu wünschen übrig. Ich hoffe ihr könnt mir weiterhelten.

Vielen dank im Voraus