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)
I too had this error when using Libgdx for android, and I found out this error is caused by Box2d which uses native code, it is better to look at part of your code which uses Box2d and see if there is any null pointers.
Same thing happened to me during game development using LibGDX framework for Android, and here's why:
I have 2 screens -
GameScreen
andBattleScreen
.GameScreen
is where I move my character on the map. When I have collision with enemy sprite I instantly usegame.setScreen(new BattleScreen(this))
and change current screen toBattleScreen
. Here's where the Fatal Signal 11 used to happen. At first I thought it had something to do with loading assets, because my asset manager instance was static. I was trying multiple ways of loading them but nothing worked. It turned out I was changing the screen in the wrong place. For myGameScreen
I hadWorldController
andWorldRenderer
instance. I was usingworldController.update()
andworldRenderer.render()
insideGameScreen
'srender(float deltaTime)
method. InsideworldController.update()
I was checking for collisions and changing screen as soon as I found one with the enemy. It was not good for Android, maybe because it happened between update and render, or it took some time, while update was still running and it lead to conflicts - I don't know. But here is how I fixed it:WorldController
and everytime a collision with enemy happened I was setting it to trueGameScreen
'srender()
I was checking this flag - if it was true I would change the screen toBattleScreen
, otherwise I would update and renderGameScreen
Now it works perfectly everytime, no FATAL SIGNAL ERROR 11 whatsoever
Here's my
GameScreen
'srender()
method: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.
In my case, it was a null pointer exception inside an onDraw event that prevent the draw to be completed on the canvas. I think is a general error message given when a draw problem ocurr.