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
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.
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.
I had this same problem this morning and was able to track it back to accidentally saving an image 800 pixels wide in the drawable-mdpi folder. When I realized what happened I tinkered with it for a second. I tried compressing it hard to see if it was related to file size and it was not. Then I tried saving it again at 650 pixels wide and it worked out of that folder. So somewhere between there is the breaking point for every folder I would guess. Then I put the 800 p wide image in the intended hdpi folder and the 480 p wide in the mdpi and it fixed it.
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