Android Fatal Signal 11

2019-01-22 10:36发布

In the app I'm developing on Android, I keep getting a Fatal Signal 11 error.

I think it's something to do with the way that I'm accessing the memory but I can't figure out what is causing it.

Any help will be much appreciated!

Here's the LogCat:

05-02 23:47:17.618: D/dalvikvm(590): GC_FOR_ALLOC freed 68K, 4% free 6531K/6787K, paused 101ms
05-02 23:47:17.638: I/dalvikvm-heap(590): Grow heap (frag case) to 7.619MB for 1228816-byte allocation
05-02 23:47:17.738: D/dalvikvm(590): GC_CONCURRENT freed 1K, 4% free 7730K/8007K, paused 5ms+14ms
05-02 23:47:17.878: D/dalvikvm(590): GC_FOR_ALLOC freed <1K, 4% free 7730K/8007K, paused 37ms
05-02 23:47:17.888: I/dalvikvm-heap(590): Grow heap (frag case) to 8.790MB for 1228816-byte allocation
05-02 23:47:17.998: D/dalvikvm(590): GC_CONCURRENT freed <1K, 4% free 8930K/9223K, paused 4ms+4ms
05-02 23:47:17.998: A/libc(590): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

10条回答
倾城 Initia
2楼-- · 2019-01-22 10:52

I had the same problem and found after a good night of sleep and a coffee in the morning that I had been silly enough to back the canvas with an uninitialized Bitmap. It seems that much if not all of the canvas drawing code is native code and passing of uninitialized objects is not detected everywhere.

SIGSEGV with a null address (0x00000000) means that your application has dereferenced a null pointer, so look out for places where you pass null pointers (i.e. empty references to object instances you haven't instantiated in the first place) to code that is backed by native code and does not properly check for this error.

查看更多
\"骚年 ilove
3楼-- · 2019-01-22 10:53

I experienced the same Fatal error while using Canvas class.
My code looks likes this. The following piece of code initializes an Arc and draws it on the canvas.

private RectF r1 = null;
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

public Arc(Context ctx) {
    super(ctx);
    mPaint.setColor(0xFFFF0000);
    r1 = new RectF(200, 200, 400, 400);
}

protected void onDraw(Canvas canvas) {
   super.onDraw(canvas);
   canvas.drawArc(r1, 0, 90, true, mPaint);
}

The problem occurred because my instance of RectF was not initialized which resulted in NullPointerException and the fatal error.

查看更多
聊天终结者
4楼-- · 2019-01-22 10:55

I had been trying to call an uninitialised Canvas inside another Class so when it was trying to get the height or width of it, it would crash.

查看更多
叼着烟拽天下
5楼-- · 2019-01-22 10:55

i had this problem when i was making a cocos2d-x app on android. the problem was that my layer was a CCLayer:

 CCLayer::init()

but in the header file i had:

 class HelloWorld : public cocos2d::CCLayerColor

i changed CCLayerColor to CCLayer and my app worked

查看更多
甜甜的少女心
6楼-- · 2019-01-22 10:58

In my case the BluetoothSocket was null when trying to establish a Bluetooth connection

查看更多
萌系小妹纸
7楼-- · 2019-01-22 10:59

I had the same problem with an instance of android.media.MediaRecorder.

The code accessed #getMaxAmplitude() after #reset() and #release() on the MediaRecorder instance had been called.

查看更多
登录 后发表回答