Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
229 views
in Technique[技术] by (71.8m points)

android - Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1) error

i am on a game project in android with andengine like FruitNinja in which i am using to throw images from bottom to top project is working fine but giving error this sometimes i used System.gc() but not helpful

Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)

my code is

private void throwHardware(final float pX, final float pY) {

    final FixtureDef boxFixtureDef = PhysicsFactory.createFixtureDef(0.1f,
            0.5f, 0.5f);
    boxFixtureDef.filter.categoryBits = 0x0002;
    boxFixtureDef.filter.maskBits = 0x0004;
    boxFixtureDef.filter.groupIndex = 2;
    Random rng = new Random();
    generated1 = new ArrayList<Integer>();
    r = rng.nextInt(8);
    Log.e(Integer.toString(r), "r");
    if (r == 0) {
        Hardware = new Sprite(pX, pY, java,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);
        mHardware[active] = new Sprite(pX, pY, java,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {

                    if (a == 0) {
                        score();
                        remove();
                        question();
                    } else {
                        remove();
                        wrong();
                        question();

                    }
                    return true;
                }
                return true;
            };
        };
    } else if (r == 1) {
        Hardware = new Sprite(pX, pY, facebook,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);

        mHardware[active] = new Sprite(pX, pY, this.facebook,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {
                    if (a == 1) {
                        score();
                        remove();
                        question();
                    } else {
                        remove();
                        wrong();
                        question();
                    }
                    return true;
                }
                return true;
            };
        };
    } else if (r == 2) {
        Hardware = new Sprite(pX, pY, android,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);
        mHardware[active] = new Sprite(pX, pY, android,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {
                    if (a == 2) {
                        score();
                        remove();
                        question();
                    } else {
                        remove();
                        wrong();
                        question();

                    }
                    return true;
                }
                return true;
            };
        };
    } else if (r == 3) {
        Hardware = new Sprite(pX, pY, usb,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);
        mHardware[active] = new Sprite(pX, pY, usb,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {
                    if (a == 3) {
                        score();
                        remove();
                        question();
                    } else {
                        remove();
                        wrong();
                        question();

                    }
                    return true;
                }
                return true;
            };
        };
    } else if (r == 4) {
        Hardware = new Sprite(pX, pY, google,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);
        mHardware[active] = new Sprite(pX, pY, google,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {
                    if (a == 4) {
                        score();
                        remove();
                        question();
                    } else {
                        remove();
                        question();
                        wrong();
                    }
                    return true;
                }
                return true;
            };
        };
    } else if (r == 5) {
        Hardware = new Sprite(pX, pY, ram,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);
        mHardware[active] = new Sprite(pX, pY, ram,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {
                    if (a == 5) {
                        score();
                        remove();
                        question();
                    } else {
                        remove();
                        question();
                        wrong();
                    }
                    return true;
                }
                return true;
            };
        };
    } else if (r == 6) {
        Hardware = new Sprite(pX, pY, cd,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);
        mHardware[active] = new Sprite(pX, pY, cd,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {
                    if (a == 6) {
                        score();
                        remove();
                        question();
                    } else {

                        remove();
                        wrong();
                        question();
                    }
                    return true;
                }
                return true;
            }

        };
    } else if (r == 7) {
        Hardware = new Sprite(pX, pY, samsung,
                this.getVertexBufferObjectManager());
        body = PhysicsFactory.createBoxBody(this.mPhysicsWorldg, Hardware,
                BodyType.DynamicBody, boxFixtureDef);
        mHardware[active] = new Sprite(pX, pY, samsung,
                this.getVertexBufferObjectManager()) {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                    float X, float Y) {
                if (pSceneTouchEvent.isActionDown()) {
                    if (a == 7) {
                        score();
                        remove();
                        question();
                    } else {
                        remove();
                        wrong();
                        question();
                    }
                    return true;
                }
                return true;
            };
        };
    }

    mHardwareBody[active] = PhysicsFactory.createBoxBody(
            this.mPhysicsWorldg, mHardware[active], BodyType.DynamicBody,
            boxFixtureDef);

    scene.attachChild(mHardware[active]);

    this.mPhysicsWorldg.registerPhysicsConnector(new PhysicsConnector(
            mHardware[active], mHardwareBody[active], true, false));

    Vector2 velocity = Vector2Pool.obtain(-1, -16);
    body.setTransform(velocity, 85);
    mHardwareBody[active].setLinearVelocity(velocity);
    Vector2Pool.recycle(velocity);
    this.scene.registerTouchArea(mHardware[active]);

}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Something's corrupted or uninitialised. 0xdeadbaad looks like one of those debugging/sentinel addresses like 0xdeadbeef or 0xbaadf00d.

Something you may want to look into is heap corruption. According to the Wikipedia HexSpeak page:

0xDEADBAAD ("dead bad") is used by the Android libc abort() function when native heap corruption is detected.

There's not really enough information in your question to give specific guidanve for fixing such a problem, it may be worth contacting the AndEngine bods to see what they think, assuming it's something being caused by their code (or your code indirectly through theirs).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...