My app crashes when hitting the back button

I’m new to corona and lua, so please forgive me in advanced.

The problem is my app crashes when I hit the Android back button. It’s supposed to go back to the Menu scene, which happens for a split second, then crashes on Android devices and the Android Emulator.

I setup adb to see the print commands as seen in the Debugging on Device Tips and Tricks thread, but I’m unable to pinpoint the problem… I basically need more information.

So basically this is what happens:

  • App starts and loads the “Menu” scene

  • User selects difficulty then proceeds to the next scene

  • Tap the “Back” button at any point

  • Loads the “Menu” scene for a split second

  • App crashes with a oh so helpful “Unfortunately, AppName has stopped.” dialog window.

main.lua (not complete, but hopefully the relevant parts)

local function onKeyEvent( event ) local keyName = event.keyName if (keyName == "back") then storyboard.gotoScene("menu") end end storyboard.gotoScene("menu") Runtime:addEventListener("key", onKeyEvent)

menu.lua (complete code)

local storyboard = require("storyboard") local scene = storyboard.newScene() local btnEasy local btnMedium local btnHard local btnVeryHard ----------------------------------------------------------------------- -- Event Listeners ----------------------------------------------------------------------- function gotoNextScene(difficulty) local options = { effect = "fade", time = 400, params = { difficulty = difficulty } } storyboard.gotoScene("memory", options) return true end ----------------------------------------------------------------------- -- Scene Listeners ----------------------------------------------------------------------- -- Called when the scene's view does not exist: function scene:createScene(event) local group = self.view --Difficulty buttons settings local buttonFontSize = 50 local red = 0.2549 local green = 0.5804 local blue = 0.9569 --Setup title local gameTitle = display.newText("Memory", 0, 0, FONT\_DEFAULT, 140) gameTitle.x = halfW gameTitle.y = halfH - 475 gameTitle:setFillColor(0.9294, 0.28627, 0.45882) --Setup logo local image = display.newImage(IMAGE\_FOLDER .. "brain.png", halfW, halfH - 120) image:scale(0.85, 0.85) --Setup buttons btnEasy = display.newText("Easy", 0, 0, FONT\_DEFAULT, buttonFontSize) btnMedium = display.newText("Medium", 0, 0, FONT\_DEFAULT, buttonFontSize) btnHard = display.newText("Hard", 0, 0, FONT\_DEFAULT, buttonFontSize) btnVeryHard = display.newText("Very Hard", 0, 0, FONT\_DEFAULT, buttonFontSize) btnEasy:setFillColor(red, green, blue) btnMedium:setFillColor(red, green, blue) btnHard:setFillColor(red, green, blue) btnVeryHard:setFillColor(red, green, blue) btnEasy:addEventListener("tap", function() gotoNextScene(DIFF\_EASY) end) btnMedium:addEventListener("tap", function() gotoNextScene(DIFF\_MEDIUM) end) btnHard:addEventListener("tap", function() gotoNextScene(DIFF\_HARD) end) btnVeryHard:addEventListener("tap", function() gotoNextScene(DIFF\_VERYHARD) end) btnEasy.x = halfW btnEasy.y = halfH + 200 btnMedium.x = halfW btnMedium.y = halfH + 300 btnHard.x = halfW btnHard.y = halfH + 400 btnVeryHard.x = halfW btnVeryHard.y = halfH + 500 group:insert(gameTitle) group:insert(image) group:insert(btnEasy) group:insert(btnMedium) group:insert(btnHard) group:insert(btnVeryHard) end function scene:enterScene(event) storyboard.purgeScene("memory") storyboard.purgeScene("guess") end function scene:exitScene(event) btnEasy:removeEventListener("tap", function() gotoNextScene(DIFF\_EASY) end) btnMedium:removeEventListener("tap", function() gotoNextScene(DIFF\_EASY) end) btnHard:removeEventListener("tap", function() gotoNextScene(DIFF\_EASY) end) btnVeryHard:removeEventListener("tap", function() gotoNextScene(DIFF\_EASY) end) end function scene:destroyScene(event) end ----------------------------------------------------------------------- -- Init ----------------------------------------------------------------------- scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene) return scene

Any info/tips would be appreciated. Perhaps if there is a way to get a crash report from the device/emulator?

Can you post the printout from the ADB crash log?

This is from running on the emulator. I hope it makes sense to you, because it doesn’t to me lol

 I/ActivityManager(  359): Displayed ca.redcar.memory/com.ansca.corona.CoronaActi

vity: +2s361ms

V/GLSurfaceView(  976): glGetString(7937) returns Android Emulator OpenGL ES Tra

nslator (GeForce 8800 GTS/PCIe/SSE2);

V/Corona  (  976): > Class.forName: network.LuaLoader

V/Corona  (  976): < Class.forName: network.LuaLoader

V/Corona  (  976): Loading via reflection: network.LuaLoader

W/linker  (  976): liblicensing.so has text relocations. This is wasting memory

and is a security risk. Please fix.

V/Corona  (  976): > Class.forName: CoronaProvider.licensing.google.LuaLoader

V/Corona  (  976): < Class.forName: CoronaProvider.licensing.google.LuaLoader

V/Corona  (  976): Loading via reflection: CoronaProvider.licensing.google.LuaLo

ader

D/dalvikvm(  976): GC_CONCURRENT freed 402K, 14% free 3033K/3504K, paused 5ms+3m

s, total 67ms

D/dalvikvm(  517): GC_FOR_ALLOC freed 99K, 7% free 9494K/10180K, paused 46ms, to

tal 46ms

D/dalvikvm(  517): GC_FOR_ALLOC freed 36K, 7% free 10662K/11348K, paused 49ms, t

otal 61ms

I/Corona  (  976): Memory: 0.24246875MB

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressStandard.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressStandard.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressSpacebar.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressSpacebar.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressDelete.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressDelete.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressReturn.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressReturn.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressInvalid.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressInvalid.ogg

W/AudioService(  359): onLoadSoundEffects(), Error -1 while loading samples

D/dalvikvm(  976): GC_FOR_ALLOC freed 223K, 16% free 3041K/3604K, paused 96ms, t

otal 97ms

E/gralloc_goldfish(   49): gralloc_alloc: Mismatched usage flags: 266 x 425, usa

ge 333

W/GraphicBufferAllocator(   49): alloc(266, 425, 1, 00000333, …) failed -22 (I

nvalid argument)

E/        (   49): GraphicBufferAlloc::createGraphicBuffer(w=266, h=425) failed

(Invalid argument), handle=0x0

E/BufferQueue(  359): [ScreenshotClient] dequeueBuffer: SurfaceComposer::createG

raphicBuffer failed

W/WindowManager(  359): Screenshot failure taking screenshot for (266x425) to la

yer 21015

W/EGL_emulation(  517): eglSurfaceAttrib not implemented

F/libc    (  976): Fatal signal 11 (SIGSEGV) at 0xfffffffe (code=1), thread 993

(Thread-69)

I/DEBUG   (   47): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *

**

I/DEBUG   (   47): Build fingerprint: 'generic/sdk/generic:4.4/KRT16L/892118:eng

/test-keys’

I/DEBUG   (   47): Revision: ‘0’

I/DEBUG   (   47): pid: 976, tid: 993, name: Thread-69  >>> ca.redcar.memory <<<

I/DEBUG   (   47): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr fffffff

e

I/DEBUG   (   47):     r0 b7a8e730  r1 00000000  r2 00000000  r3 00000000

I/DEBUG   (   47):     r4 00000000  r5 b6f13190  r6 00000000  r7 00000000

I/DEBUG   (   47):     r8 b79f3640  r9 00000000  sl 00000000  fp 00000000

I/DEBUG   (   47):     ip ffffffff  sp ab259d10  lr aef10737  pc fffffffe  cpsr

a0000030

I/DEBUG   (   47):     d0  3f96397ef7b57000  d1  3ce38c88988ccba2

I/DEBUG   (   47):     d2  3fe0000000000000  d3  4022000000000000

I/DEBUG   (   47):     d4  4024000000000000  d5  3ff0000000000000

I/DEBUG   (   47):     d6  3ff0000000000000  d7  0000000000000000

I/DEBUG   (   47):     d8  0000000000000000  d9  0000000000000000

I/DEBUG   (   47):     d10 0000000000000000  d11 0000000000000000

I/DEBUG   (   47):     d12 0000000000000000  d13 0000000000000000

I/DEBUG   (   47):     d14 0000000000000000  d15 0000000000000000

I/DEBUG   (   47):     scr 20000010

I/DEBUG   (   47):

I/DEBUG   (   47): backtrace:

I/DEBUG   (   47):     #00  pc fffffffe  <unknown>

I/DEBUG   (   47):     #01  pc 00007735  /system/lib/egl/libEGL_emulation.so

I/DEBUG   (   47):     #02  pc 0000f059  /system/lib/libEGL.so (eglReleaseThread

+44)

I/DEBUG   (   47):     #03  pc 0000d538  /system/lib/libc.so

I/DEBUG   (   47):     #04  pc 0000ec78  /system/lib/libc.so (pthread_exit+80)

I/DEBUG   (   47):     #05  pc 0000d1f8  /system/lib/libc.so (pthread_create+240

)

I/DEBUG   (   47):

I/DEBUG   (   47): stack:

I/DEBUG   (   47):          ab259cd0  00000000

I/DEBUG   (   47):          ab259cd4  ab259d44  [stack:993]

I/DEBUG   (   47):          ab259cd8  00000000

I/DEBUG   (   47):          ab259cdc  b5ab0323  /system/lib/libdvm.so (dvmCallMe

thodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+346)

I/DEBUG   (   47):          ab259ce0  b6e86df0  /system/lib/libbinder.so

I/DEBUG   (   47):          ab259ce4  b79f5d80  [heap]

I/DEBUG   (   47):          ab259ce8  00000000

I/DEBUG   (   47):          ab259cec  ae742fc3  /system/lib/libOpenglSystemCommo

n.so (HostConnection::get()+6)

I/DEBUG   (   47):          ab259cf0  b79f3640  [heap]

I/DEBUG   (   47):          ab259cf4  00000000

I/DEBUG   (   47):          ab259cf8  00000000

I/DEBUG   (   47):          ab259cfc  00000000

I/DEBUG   (   47):          ab259d00  00000000

I/DEBUG   (   47):          ab259d04  00000000

I/DEBUG   (   47):          ab259d08  b6f13190

I/DEBUG   (   47):          ab259d0c  aef10715  /system/lib/egl/libEGL_emulation

.so

I/DEBUG   (   47):     #00  ab259d10  b6f11510  /system/lib/libc.so

I/DEBUG   (   47):          …  …

I/DEBUG   (   47):     #01  ab259d10  b6f11510  /system/lib/libc.so

I/DEBUG   (   47):          ab259d14  b6ed711f  /system/lib/libc.so (dlfree+50)

I/DEBUG   (   47):          ab259d18  b6f0f000  /system/lib/libc.so

I/DEBUG   (   47):          ab259d1c  b79f5d80  [heap]

I/DEBUG   (   47):          ab259d20  b79f5d80  [heap]

I/DEBUG   (   47):          ab259d24  00000000

I/DEBUG   (   47):          ab259d28  b6e793b1  /system/lib/libbinder.so (androi

d::IPCThreadState::threadDestructor(void*))

I/DEBUG   (   47):          ab259d2c  b6ed3afd  /system/lib/libc.so (free+12)

I/DEBUG   (   47):          ab259d30  b79f5d48  [heap]

I/DEBUG   (   47):          ab259d34  b6f11320  /system/lib/libc.so

I/DEBUG   (   47):          ab259d38  b6e793b1  /system/lib/libbinder.so (androi

d::IPCThreadState::threadDestructor(void*))

I/DEBUG   (   47):          ab259d3c  b6cb9de8  /system/lib/libEGL.so

I/DEBUG   (   47):          ab259d40  b6f1132c  /system/lib/libc.so

I/DEBUG   (   47):          ab259d44  b6c7d02d  /system/lib/libEGL.so (eglReleas

eThread)

I/DEBUG   (   47):          ab259d48  b79ee808  [heap]

I/DEBUG   (   47):          ab259d4c  b6f11510  /system/lib/libc.so

I/DEBUG   (   47):          …  …

I/DEBUG   (   47):     #02  ab259d60  0000001a

I/DEBUG   (   47):          ab259d64  b6ed353c  /system/lib/libc.so

I/DEBUG   (   47):

I/DEBUG   (   47): memory near r0:

I/DEBUG   (   47):     b7a8e710 ac119e28 00000003 b7ad5f00 00000001

I/DEBUG   (   47):     b7a8e720 ac119d60 b7ad5ee8 00000002 00000007

I/DEBUG   (   47):     b7a8e730 00000004 00000011 b6f13190 b79f6d28

I/DEBUG   (   47):     b7a8e740 00000010 0000013a ffffffff ffffffff

I/DEBUG   (   47):     b7a8e750 ffff0021 ffffffff ffff0004 0011ffff

I/DEBUG   (   47):     b7a8e760 ffff0016 ffffffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e770 ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e780 ffffffff ffffffff ffff0018 ffffffff

I/DEBUG   (   47):     b7a8e790 0006ffff ffffffff ffffffff 0000ffff

I/DEBUG   (   47):     b7a8e7a0 ffffffff ffffffff 0014ffff ffffffff

I/DEBUG   (   47):     b7a8e7b0 ffffffff ffffffff ffff0017 ffffffff

I/DEBUG   (   47):     b7a8e7c0 ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e7d0 000fffff ffff000b ffff000e ffff0009

I/DEBUG   (   47):     b7a8e7e0 ffffffff ffffffff ffff000a ffffffff

I/DEBUG   (   47):     b7a8e7f0 ffffffff 0020ffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e800 ffffffff ffff0015 ffffffff ffffffff

I/DEBUG   (   47):

I/DEBUG   (   47): memory near r5:

I/DEBUG   (   47):     b6f13170 b7ad66f8 00200000 000007db 07fac2d8

I/DEBUG   (   47):     b6f13180 00000000 00000000 b6f13180 b6f13180

I/DEBUG   (   47):     b6f13190 b6f13188 b6f13188 b79f3400 b7a8e730

I/DEBUG   (   47):     b6f131a0 b79f3e98 b7a97898 b7a154c0 b7a95028

I/DEBUG   (   47):     b6f131b0 b789c9b8 b7ad60a0 b78bfd50 b7a01c30

I/DEBUG   (   47):     b6f131c0 b7ad5e98 b79e45f8 b79ee6b8 b7a01310

I/DEBUG   (   47):     b6f131d0 b7a15368 b789ba58 b79e73e8 b79f2eb8

I/DEBUG   (   47):     b6f131e0 b7a56588 b79f3948 b7a96888 b79f44e8

I/DEBUG   (   47):     b6f131f0 b79ee798 b7a48af8 b7a7a170 b7a02cc0

I/DEBUG   (   47):     b6f13200 b7a15210 b7a15210 b7a16ff0 b7a16ff0

I/DEBUG   (   47):     b6f13210 b79e5f28 b79ef178 b7a15108 b7a15108

I/DEBUG   (   47):     b6f13220 b79f1930 b79f1930 b79f6000 b79f6000

I/DEBUG   (   47):     b6f13230 b7a17f30 b7a17f30 b7a4a758 b79fd018

I/DEBUG   (   47):     b6f13240 b7a022f0 b7a022f0 b79f3f18 b79f3f18

I/DEBUG   (   47):     b6f13250 b7a02970 b7a023d8 b7a020e8 b7a49878

I/DEBUG   (   47):     b6f13260 b7a226a0 b7a48bd0 b7ab2560 b7a39598

I/DEBUG   (   47):

I/DEBUG   (   47): memory near r8:

I/DEBUG   (   47):     b79f3620 b79f35c8 b79f3100 3aaaaaab 3d200000

I/DEBUG   (   47):     b79f3630 3f465555 3f54aaab b79f2708 00000011

I/DEBUG   (   47):     b79f3640 b7a15550 b79f3400 00003000 00000032

I/DEBUG   (   47):     b79f3650 b78bcef0 00000001 0000014b 00000000

I/DEBUG   (   47):     b79f3660 b79f33c0 00000000 3aaaaaab 3d200000

I/DEBUG   (   47):     b79f3670 3edcaaab 3ef95555 b79f2708 0000004b

I/DEBUG   (   47):     b79f3680 b64451c0 00000001 00000000 00000001

I/DEBUG   (   47):     b79f3690 0000001d 0000002b 00000000 00000000

I/DEBUG   (   47):     b79f36a0 00000000 b79f36dc 0000812f 0000812f

I/DEBUG   (   47):     b79f36b0 00002600 00002600 00000101 b79f2508

I/DEBUG   (   47):     b79f36c0 b79f2fe8 00000033 b78c0ac8 00000001

I/DEBUG   (   47):     b79f36d0 00000177 00000000 b79f3680 00000000

I/DEBUG   (   47):     b79f36e0 3aaaaaab 3d200000 3efa0000 3f0b5555

I/DEBUG   (   47):     b79f36f0 b79f2708 0000004b b64451c0 00000001

I/DEBUG   (   47):     b79f3700 00000000 00000001 0000001d 0000002b

I/DEBUG   (   47):     b79f3710 00000000 00000000 00000000 b79f3754

I/DEBUG   (   47):

I/DEBUG   (   47): memory near sp:

I/DEBUG   (   47):     ab259cf0 b79f3640 00000000 00000000 00000000

I/DEBUG   (   47):     ab259d00 00000000 00000000 b6f13190 aef10715

I/DEBUG   (   47):     ab259d10 b6f11510 b6ed711f b6f0f000 b79f5d80

I/DEBUG   (   47):     ab259d20 b79f5d80 00000000 b6e793b1 b6ed3afd

I/DEBUG   (   47):     ab259d30 b79f5d48 b6f11320 b6e793b1 b6cb9de8

I/DEBUG   (   47):     ab259d40 b6f1132c b6c7d02d b79ee808 b6f11510

I/DEBUG   (   47):     ab259d50 b6f112c8 ab259dd0 b6f112c8 b6c7d05b

I/DEBUG   (   47):     ab259d60 0000001a b6ed353c b5aff500 00000002

I/DEBUG   (   47):     ab259d70 00000004 b6f112c8 00000001 b79e6e28

I/DEBUG   (   47):     ab259d80 00000000 00000000 000fe000 ab15c000

I/DEBUG   (   47):     ab259d90 ab15c000 be9bf644 b6f112c4 b6ed4c7c

I/DEBUG   (   47):     ab259da0 ab259dd0 b79e6e28 b5aa4f8d b79e69d0

I/DEBUG   (   47):     ab259db0 b5aa4f8d b79e6e28 ab259dd0 00000000

I/DEBUG   (   47):     ab259dc0 00000078 b5aa4f8d be9bf644 b6ed31fc

I/DEBUG   (   47):     ab259dd0 ab259dd0 b79e6e28 00000016 b6cc1844

I/DEBUG   (   47):     ab259de0 b79f3640 75aa65ae b79e6e68 00000000

I/DEBUG   (   47):

I/DEBUG   (   47): code around pc:

I/DEBUG   (   47):     ffffffdc ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):     ffffffec ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):

I/DEBUG   (   47): code around lr:

I/DEBUG   (   47):     aef10714 b9404603 20064983 44794a83 447a9305

I/DEBUG   (   47):     aef10724 e92cf7fd 464be7e6 c048f8d0 46524659

I/DEBUG   (   47):     aef10734 468147e0 4d7db9d8 4a7d2006 4c7d447d

I/DEBUG   (   47):     aef10744 4629447a f7fd447c f7fde91a 497ae966

I/DEBUG   (   47):     aef10754 44794a7a 91039400 0406f243 94024629

I/DEBUG   (   47):     aef10764 4603447a 30b7f240 20069001 2c00e7bd

I/DEBUG   (   47):     aef10774 69a3d033 2b0260e6 61276826 3080f446

I/DEBUG   (   47):     aef10784 46286020 f7fdd114 6b26e960 634cf8c0

I/DEBUG   (   47):     aef10794 f7fd4628 6b62e95a 91082100 46069207

I/DEBUG   (   47):     aef107a4 90096be0 f7ffa807 f506fe8b e0337054

I/DEBUG   (   47):     aef107b4 e950f7fd f8c06b21 46281498 e94af7fd

I/DEBUG   (   47):     aef107c4 22006be3 93099208 6b604606 a8079007

I/DEBUG   (   47):     aef107d4 fe76f7ff 409cf206 f8d8e01e 46281000

I/DEBUG   (   47):     aef107e4 2a02698a f7fdd10c f8c0e930 4628434c

I/DEBUG   (   47):     aef107f4 e92af7fd 94099408 f5009407 e00b7054

I/DEBUG   (   47):     aef10804 e928f7fd 4498f8c0 f7fd4628 9408e924

I/DEBUG   (   47):

I/DEBUG   (   47): memory map around fault addr fffffffe:

I/DEBUG   (   47):     ffff0000-ffff1000 r-x [vectors]

I/DEBUG   (   47):     (no map for address)

I/DEBUG   (   47):     (no map above)

I/BootReceiver(  359): Copying /data/tombstones/tombstone_04 to DropBox (SYSTEM_

TOMBSTONE)

D/dalvikvm(  359): GC_FOR_ALLOC freed 211K, 11% free 5769K/6436K, paused 83ms, t

otal 85ms

I/dalvikvm-heap(  359): Grow heap (frag case) to 5.875MB for 181730-byte allocat

ion

D/dalvikvm(  359): GC_FOR_ALLOC freed 2K, 11% free 5944K/6616K, paused 80ms, tot

al 80ms

D/dalvikvm(  359): GC_FOR_ALLOC freed 156K, 12% free 6036K/6796K, paused 131ms,

total 135ms

D/dalvikvm(  359): GC_FOR_ALLOC freed <1K, 10% free 6125K/6796K, paused 84ms, to

tal 84ms

I/dalvikvm-heap(  359): Grow heap (frag case) to 6.527MB for 500416-byte allocat

ion

D/dalvikvm(  359): GC_FOR_ALLOC freed 0K, 10% free 6614K/7288K, paused 90ms, tot

al 90ms

D/Zygote  (   50): Process 976 terminated by signal (11)

I/ActivityManager(  359): Process ca.redcar.memory (pid 976) has died.

D/        (  359): HostConnection::get() New Host Connection established 0xb7b03

b70, tid 374

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressStandard.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressStandard.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressSpacebar.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressSpacebar.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressDelete.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressDelete.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressReturn.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressReturn.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressInvalid.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressInvalid.ogg

W/AudioService(  359): onLoadSoundEffects(), Error -1 while loading samples

W/InputMethodManagerService(  359): Window already focused, ignoring focus gain

of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b3f09bd0 attribute=n

ull, token = android.os.BinderProxy@b3e79240

D/dalvikvm(  505): GC_CONCURRENT freed 331K, 14% free 3337K/3868K, paused 80ms+5

ms, total 143ms

Your first potential problem is using closures/anonymous functions in your addEventListener/removeEventListener:

btnEasy:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)
btnMedium:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)
btnHard:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)
btnVeryHard:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)

the problem here is that event listeners store the event type (i.e. “tap”) and the address of the function it supposed to call in a table.  When you do a closure you get an address to the function created in the addEventListener().  Then when you call removeEventListener, it gets an address for the closure function and that’s a different address, so it can’t match it up with what’s in the saved table.

But likely what is crashing you is these lines in enterScene()

storyboard.purgeScene(“memory”)
storyboard.purgeScene(“guess”)

Perhaps something is getting destroyed in memory.lua or guess.lua that either has a transition still running against it, something being effected by a timer or a Runtime event, physics collision that’s still going on (you can turn your physics hybrid display mode on for that one), any thing that would have an onComplete function that’s getting called.

The fact that you see the scene for a brief second means you are getting to the enterScene() function and there really isn’t much else that would crash your app otherwise.

Rob

Thanks for the reply.

For the listeners I changed my code to this…

btnEasy:addEventListener("tap", easySetup) btnEasy:removeEventListener("tap", easySetup) local function easySetup() gotoNextScene(DIFF\_EASY) end

It still crashed.  :frowning:

A little more info on the app. After the “Menu” scene, the “Memory” scene loads then alternates between the “Memory” and “Guess” scenes.

This is a pretty simple app to get my feet wet. The only onComplete function I have is for a sound. Other then the back button, there are no Runtime events. I’m not using any physics or timers either.

I removed the sound, but it still crashes.

I’m checking the memory usage using collectgarbage(“count”) it reports the same amount every time, so I’m assuming things are cleaning up nicely.

For fun, I commented out the purge

function scene:enterScene(event) --storyboard.purgeScene("memory") --storyboard.purgeScene("guess") end

I wasn’t too hopeful about this since it’s something new I added; the crash has been around for a while. It still crashed  :frowning:

It may be time to put in print statements to try and narrow down where it’s happening.

Rob

I tried that today and put print statements EVERYWHERE, they were all hit.  :( So something is happening after the code is run.

I even tried stripping down the app to its most basic, see the complete code below. It still crashes.  :frowning:

main.lua

local storyboard = require("storyboard") local function onKeyEvent( event ) local keyName = event.keyName if (keyName == "back") then storyboard.gotoScene("scene1") end end storyboard.gotoScene("scene1") Runtime:addEventListener("key", onKeyEvent)

scene1.lua

local storyboard = require("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local group = self.view local btnEasy local function gotoNextScene() local options = { effect = "fade", time = 400 } storyboard.gotoScene("scene2", options) return true end btnEasy = display.newText("Scene 1", 0, 0, "", 50) btnEasy:addEventListener("tap", gotoNextScene) btnEasy.x = 200 btnEasy.y = 200 group:insert(btnEasy) end scene:addEventListener("createScene", scene) return scene

scene2.lua

local storyboard = require("storyboard") local scene = storyboard.newScene() function scene:createScene(event) local group = self.view local btnEasy local function gotoNextScene() local options = { effect = "fade", time = 400 } storyboard.gotoScene("scene1", options) return true end btnEasy = display.newText("Scene 2", 0, 0, "", 50) btnEasy:addEventListener("tap", gotoNextScene) btnEasy.x = 200 btnEasy.y = 200 group:insert(btnEasy) end scene:addEventListener("createScene", scene) return scene

I also added the back button code to the “Storyboard” example project in the main.lua file, it still crashes.  :frowning:

local function onKeyEvent( event ) local keyName = event.keyName if (keyName == "back") then storyboard.gotoScene("scene1") end end Runtime:addEventListener("key", onKeyEvent)

Am I doing something stupid? Could there be a bug with Corona? Maybe I’ll try re-installing everything tomorrow.  :wacko:

can you try this:

local function onKeyEvent( event ) local keyName = event.keyName if (keyName == "back") then print( "Back pressed" ) storyboard.gotoScene("scene1") end return true end Runtime:addEventListener("key", onKeyEvent)

And tell me know many times “Back pressed” gets printed to the console?

I think I know where you’re going with this, I can only assure you I’m not double tapping lol. The “Memory” statement is coming from the next scene after the “menu” scene.

I still have the purge commented out, so it’s only the print statement.

function scene:enterScene(event) print("menu enterScene") --storyboard.purgeScene("memory") --storyboard.purgeScene("guess") end

This is a screen shot from the Emulator:

emulator.png

And from my test device (a tablet):

tablet.png

I know exactly where Danny is going.  There are two phases for the key press:  “up” and “down”.  If you don’t trap for that, you end up executing the code twice, once for “down” and once for “up”.

Rob

I don’t know where I stole my original code from, but I changed it to this:

local function onKeyEvent( event ) local keyName = event.keyName local phase = event.phase if (keyName == "back" and phase == "up") then print( "Back pressed" ) storyboard.gotoScene("menu") end end

emulator2.png

The app still crashes *cries*

I think I have it.  You’re not returning true or false back to the system to know if it’s handling the event or not.  A return of true means “Hey I handled that”.  A return of false means “hey OS you need to take care of this”.

local storyboard = require("storyboard") local function onKeyEvent( event ) &nbsp;&nbsp;&nbsp; local keyName = event.keyName &nbsp;&nbsp;&nbsp; local phase = event.phase &nbsp;&nbsp;&nbsp; if (keyName == "back" and phase == "up") then &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print( "Back pressed" ) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; storyboard.gotoScene("scene1") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true &nbsp;&nbsp;&nbsp; end &nbsp;&nbsp;&nbsp; return false end storyboard.gotoScene("scene1") Runtime:addEventListener("key", onKeyEvent)

The un-trapped up key was telling the OS to exit the app.  It really wasn’t crashing.

Rob

That was it. :lol:

Why is it always the simple solutions that cause the most grief? lol

Thanks so much for your help.  :slight_smile:

Hi guys, Very helpful post! Just a quick question: I am assuming that the onKey listener function need to be present ONLY in the main.lua and not on every scene right? (using Storyboard) Thanks a lot. I am starting converting an iOS app and the back button is giving a headache! Mo

That’s correct. Main.lua is where I have the “Best Answer” code. It’s global, so it doesn’t matter what scene your on when you click the back button, the listener function will be called.

You only need to catch the keys with one event listener. To me main.lua is the best place to do that.

Rob

Thanks Patrick, Rob. Yes I can see now why my app was behaving bizarre. I had the onKey listener on each scene!!

Cheers.

Mo

Can you post the printout from the ADB crash log?

This is from running on the emulator. I hope it makes sense to you, because it doesn’t to me lol

 I/ActivityManager(  359): Displayed ca.redcar.memory/com.ansca.corona.CoronaActi

vity: +2s361ms

V/GLSurfaceView(  976): glGetString(7937) returns Android Emulator OpenGL ES Tra

nslator (GeForce 8800 GTS/PCIe/SSE2);

V/Corona  (  976): > Class.forName: network.LuaLoader

V/Corona  (  976): < Class.forName: network.LuaLoader

V/Corona  (  976): Loading via reflection: network.LuaLoader

W/linker  (  976): liblicensing.so has text relocations. This is wasting memory

and is a security risk. Please fix.

V/Corona  (  976): > Class.forName: CoronaProvider.licensing.google.LuaLoader

V/Corona  (  976): < Class.forName: CoronaProvider.licensing.google.LuaLoader

V/Corona  (  976): Loading via reflection: CoronaProvider.licensing.google.LuaLo

ader

D/dalvikvm(  976): GC_CONCURRENT freed 402K, 14% free 3033K/3504K, paused 5ms+3m

s, total 67ms

D/dalvikvm(  517): GC_FOR_ALLOC freed 99K, 7% free 9494K/10180K, paused 46ms, to

tal 46ms

D/dalvikvm(  517): GC_FOR_ALLOC freed 36K, 7% free 10662K/11348K, paused 49ms, t

otal 61ms

I/Corona  (  976): Memory: 0.24246875MB

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressStandard.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressStandard.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressSpacebar.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressSpacebar.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressDelete.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressDelete.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressReturn.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressReturn.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressInvalid.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressInvalid.ogg

W/AudioService(  359): onLoadSoundEffects(), Error -1 while loading samples

D/dalvikvm(  976): GC_FOR_ALLOC freed 223K, 16% free 3041K/3604K, paused 96ms, t

otal 97ms

E/gralloc_goldfish(   49): gralloc_alloc: Mismatched usage flags: 266 x 425, usa

ge 333

W/GraphicBufferAllocator(   49): alloc(266, 425, 1, 00000333, …) failed -22 (I

nvalid argument)

E/        (   49): GraphicBufferAlloc::createGraphicBuffer(w=266, h=425) failed

(Invalid argument), handle=0x0

E/BufferQueue(  359): [ScreenshotClient] dequeueBuffer: SurfaceComposer::createG

raphicBuffer failed

W/WindowManager(  359): Screenshot failure taking screenshot for (266x425) to la

yer 21015

W/EGL_emulation(  517): eglSurfaceAttrib not implemented

F/libc    (  976): Fatal signal 11 (SIGSEGV) at 0xfffffffe (code=1), thread 993

(Thread-69)

I/DEBUG   (   47): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *

**

I/DEBUG   (   47): Build fingerprint: 'generic/sdk/generic:4.4/KRT16L/892118:eng

/test-keys’

I/DEBUG   (   47): Revision: ‘0’

I/DEBUG   (   47): pid: 976, tid: 993, name: Thread-69  >>> ca.redcar.memory <<<

I/DEBUG   (   47): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr fffffff

e

I/DEBUG   (   47):     r0 b7a8e730  r1 00000000  r2 00000000  r3 00000000

I/DEBUG   (   47):     r4 00000000  r5 b6f13190  r6 00000000  r7 00000000

I/DEBUG   (   47):     r8 b79f3640  r9 00000000  sl 00000000  fp 00000000

I/DEBUG   (   47):     ip ffffffff  sp ab259d10  lr aef10737  pc fffffffe  cpsr

a0000030

I/DEBUG   (   47):     d0  3f96397ef7b57000  d1  3ce38c88988ccba2

I/DEBUG   (   47):     d2  3fe0000000000000  d3  4022000000000000

I/DEBUG   (   47):     d4  4024000000000000  d5  3ff0000000000000

I/DEBUG   (   47):     d6  3ff0000000000000  d7  0000000000000000

I/DEBUG   (   47):     d8  0000000000000000  d9  0000000000000000

I/DEBUG   (   47):     d10 0000000000000000  d11 0000000000000000

I/DEBUG   (   47):     d12 0000000000000000  d13 0000000000000000

I/DEBUG   (   47):     d14 0000000000000000  d15 0000000000000000

I/DEBUG   (   47):     scr 20000010

I/DEBUG   (   47):

I/DEBUG   (   47): backtrace:

I/DEBUG   (   47):     #00  pc fffffffe  <unknown>

I/DEBUG   (   47):     #01  pc 00007735  /system/lib/egl/libEGL_emulation.so

I/DEBUG   (   47):     #02  pc 0000f059  /system/lib/libEGL.so (eglReleaseThread

+44)

I/DEBUG   (   47):     #03  pc 0000d538  /system/lib/libc.so

I/DEBUG   (   47):     #04  pc 0000ec78  /system/lib/libc.so (pthread_exit+80)

I/DEBUG   (   47):     #05  pc 0000d1f8  /system/lib/libc.so (pthread_create+240

)

I/DEBUG   (   47):

I/DEBUG   (   47): stack:

I/DEBUG   (   47):          ab259cd0  00000000

I/DEBUG   (   47):          ab259cd4  ab259d44  [stack:993]

I/DEBUG   (   47):          ab259cd8  00000000

I/DEBUG   (   47):          ab259cdc  b5ab0323  /system/lib/libdvm.so (dvmCallMe

thodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+346)

I/DEBUG   (   47):          ab259ce0  b6e86df0  /system/lib/libbinder.so

I/DEBUG   (   47):          ab259ce4  b79f5d80  [heap]

I/DEBUG   (   47):          ab259ce8  00000000

I/DEBUG   (   47):          ab259cec  ae742fc3  /system/lib/libOpenglSystemCommo

n.so (HostConnection::get()+6)

I/DEBUG   (   47):          ab259cf0  b79f3640  [heap]

I/DEBUG   (   47):          ab259cf4  00000000

I/DEBUG   (   47):          ab259cf8  00000000

I/DEBUG   (   47):          ab259cfc  00000000

I/DEBUG   (   47):          ab259d00  00000000

I/DEBUG   (   47):          ab259d04  00000000

I/DEBUG   (   47):          ab259d08  b6f13190

I/DEBUG   (   47):          ab259d0c  aef10715  /system/lib/egl/libEGL_emulation

.so

I/DEBUG   (   47):     #00  ab259d10  b6f11510  /system/lib/libc.so

I/DEBUG   (   47):          …  …

I/DEBUG   (   47):     #01  ab259d10  b6f11510  /system/lib/libc.so

I/DEBUG   (   47):          ab259d14  b6ed711f  /system/lib/libc.so (dlfree+50)

I/DEBUG   (   47):          ab259d18  b6f0f000  /system/lib/libc.so

I/DEBUG   (   47):          ab259d1c  b79f5d80  [heap]

I/DEBUG   (   47):          ab259d20  b79f5d80  [heap]

I/DEBUG   (   47):          ab259d24  00000000

I/DEBUG   (   47):          ab259d28  b6e793b1  /system/lib/libbinder.so (androi

d::IPCThreadState::threadDestructor(void*))

I/DEBUG   (   47):          ab259d2c  b6ed3afd  /system/lib/libc.so (free+12)

I/DEBUG   (   47):          ab259d30  b79f5d48  [heap]

I/DEBUG   (   47):          ab259d34  b6f11320  /system/lib/libc.so

I/DEBUG   (   47):          ab259d38  b6e793b1  /system/lib/libbinder.so (androi

d::IPCThreadState::threadDestructor(void*))

I/DEBUG   (   47):          ab259d3c  b6cb9de8  /system/lib/libEGL.so

I/DEBUG   (   47):          ab259d40  b6f1132c  /system/lib/libc.so

I/DEBUG   (   47):          ab259d44  b6c7d02d  /system/lib/libEGL.so (eglReleas

eThread)

I/DEBUG   (   47):          ab259d48  b79ee808  [heap]

I/DEBUG   (   47):          ab259d4c  b6f11510  /system/lib/libc.so

I/DEBUG   (   47):          …  …

I/DEBUG   (   47):     #02  ab259d60  0000001a

I/DEBUG   (   47):          ab259d64  b6ed353c  /system/lib/libc.so

I/DEBUG   (   47):

I/DEBUG   (   47): memory near r0:

I/DEBUG   (   47):     b7a8e710 ac119e28 00000003 b7ad5f00 00000001

I/DEBUG   (   47):     b7a8e720 ac119d60 b7ad5ee8 00000002 00000007

I/DEBUG   (   47):     b7a8e730 00000004 00000011 b6f13190 b79f6d28

I/DEBUG   (   47):     b7a8e740 00000010 0000013a ffffffff ffffffff

I/DEBUG   (   47):     b7a8e750 ffff0021 ffffffff ffff0004 0011ffff

I/DEBUG   (   47):     b7a8e760 ffff0016 ffffffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e770 ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e780 ffffffff ffffffff ffff0018 ffffffff

I/DEBUG   (   47):     b7a8e790 0006ffff ffffffff ffffffff 0000ffff

I/DEBUG   (   47):     b7a8e7a0 ffffffff ffffffff 0014ffff ffffffff

I/DEBUG   (   47):     b7a8e7b0 ffffffff ffffffff ffff0017 ffffffff

I/DEBUG   (   47):     b7a8e7c0 ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e7d0 000fffff ffff000b ffff000e ffff0009

I/DEBUG   (   47):     b7a8e7e0 ffffffff ffffffff ffff000a ffffffff

I/DEBUG   (   47):     b7a8e7f0 ffffffff 0020ffff ffffffff ffffffff

I/DEBUG   (   47):     b7a8e800 ffffffff ffff0015 ffffffff ffffffff

I/DEBUG   (   47):

I/DEBUG   (   47): memory near r5:

I/DEBUG   (   47):     b6f13170 b7ad66f8 00200000 000007db 07fac2d8

I/DEBUG   (   47):     b6f13180 00000000 00000000 b6f13180 b6f13180

I/DEBUG   (   47):     b6f13190 b6f13188 b6f13188 b79f3400 b7a8e730

I/DEBUG   (   47):     b6f131a0 b79f3e98 b7a97898 b7a154c0 b7a95028

I/DEBUG   (   47):     b6f131b0 b789c9b8 b7ad60a0 b78bfd50 b7a01c30

I/DEBUG   (   47):     b6f131c0 b7ad5e98 b79e45f8 b79ee6b8 b7a01310

I/DEBUG   (   47):     b6f131d0 b7a15368 b789ba58 b79e73e8 b79f2eb8

I/DEBUG   (   47):     b6f131e0 b7a56588 b79f3948 b7a96888 b79f44e8

I/DEBUG   (   47):     b6f131f0 b79ee798 b7a48af8 b7a7a170 b7a02cc0

I/DEBUG   (   47):     b6f13200 b7a15210 b7a15210 b7a16ff0 b7a16ff0

I/DEBUG   (   47):     b6f13210 b79e5f28 b79ef178 b7a15108 b7a15108

I/DEBUG   (   47):     b6f13220 b79f1930 b79f1930 b79f6000 b79f6000

I/DEBUG   (   47):     b6f13230 b7a17f30 b7a17f30 b7a4a758 b79fd018

I/DEBUG   (   47):     b6f13240 b7a022f0 b7a022f0 b79f3f18 b79f3f18

I/DEBUG   (   47):     b6f13250 b7a02970 b7a023d8 b7a020e8 b7a49878

I/DEBUG   (   47):     b6f13260 b7a226a0 b7a48bd0 b7ab2560 b7a39598

I/DEBUG   (   47):

I/DEBUG   (   47): memory near r8:

I/DEBUG   (   47):     b79f3620 b79f35c8 b79f3100 3aaaaaab 3d200000

I/DEBUG   (   47):     b79f3630 3f465555 3f54aaab b79f2708 00000011

I/DEBUG   (   47):     b79f3640 b7a15550 b79f3400 00003000 00000032

I/DEBUG   (   47):     b79f3650 b78bcef0 00000001 0000014b 00000000

I/DEBUG   (   47):     b79f3660 b79f33c0 00000000 3aaaaaab 3d200000

I/DEBUG   (   47):     b79f3670 3edcaaab 3ef95555 b79f2708 0000004b

I/DEBUG   (   47):     b79f3680 b64451c0 00000001 00000000 00000001

I/DEBUG   (   47):     b79f3690 0000001d 0000002b 00000000 00000000

I/DEBUG   (   47):     b79f36a0 00000000 b79f36dc 0000812f 0000812f

I/DEBUG   (   47):     b79f36b0 00002600 00002600 00000101 b79f2508

I/DEBUG   (   47):     b79f36c0 b79f2fe8 00000033 b78c0ac8 00000001

I/DEBUG   (   47):     b79f36d0 00000177 00000000 b79f3680 00000000

I/DEBUG   (   47):     b79f36e0 3aaaaaab 3d200000 3efa0000 3f0b5555

I/DEBUG   (   47):     b79f36f0 b79f2708 0000004b b64451c0 00000001

I/DEBUG   (   47):     b79f3700 00000000 00000001 0000001d 0000002b

I/DEBUG   (   47):     b79f3710 00000000 00000000 00000000 b79f3754

I/DEBUG   (   47):

I/DEBUG   (   47): memory near sp:

I/DEBUG   (   47):     ab259cf0 b79f3640 00000000 00000000 00000000

I/DEBUG   (   47):     ab259d00 00000000 00000000 b6f13190 aef10715

I/DEBUG   (   47):     ab259d10 b6f11510 b6ed711f b6f0f000 b79f5d80

I/DEBUG   (   47):     ab259d20 b79f5d80 00000000 b6e793b1 b6ed3afd

I/DEBUG   (   47):     ab259d30 b79f5d48 b6f11320 b6e793b1 b6cb9de8

I/DEBUG   (   47):     ab259d40 b6f1132c b6c7d02d b79ee808 b6f11510

I/DEBUG   (   47):     ab259d50 b6f112c8 ab259dd0 b6f112c8 b6c7d05b

I/DEBUG   (   47):     ab259d60 0000001a b6ed353c b5aff500 00000002

I/DEBUG   (   47):     ab259d70 00000004 b6f112c8 00000001 b79e6e28

I/DEBUG   (   47):     ab259d80 00000000 00000000 000fe000 ab15c000

I/DEBUG   (   47):     ab259d90 ab15c000 be9bf644 b6f112c4 b6ed4c7c

I/DEBUG   (   47):     ab259da0 ab259dd0 b79e6e28 b5aa4f8d b79e69d0

I/DEBUG   (   47):     ab259db0 b5aa4f8d b79e6e28 ab259dd0 00000000

I/DEBUG   (   47):     ab259dc0 00000078 b5aa4f8d be9bf644 b6ed31fc

I/DEBUG   (   47):     ab259dd0 ab259dd0 b79e6e28 00000016 b6cc1844

I/DEBUG   (   47):     ab259de0 b79f3640 75aa65ae b79e6e68 00000000

I/DEBUG   (   47):

I/DEBUG   (   47): code around pc:

I/DEBUG   (   47):     ffffffdc ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):     ffffffec ffffffff ffffffff ffffffff ffffffff

I/DEBUG   (   47):

I/DEBUG   (   47): code around lr:

I/DEBUG   (   47):     aef10714 b9404603 20064983 44794a83 447a9305

I/DEBUG   (   47):     aef10724 e92cf7fd 464be7e6 c048f8d0 46524659

I/DEBUG   (   47):     aef10734 468147e0 4d7db9d8 4a7d2006 4c7d447d

I/DEBUG   (   47):     aef10744 4629447a f7fd447c f7fde91a 497ae966

I/DEBUG   (   47):     aef10754 44794a7a 91039400 0406f243 94024629

I/DEBUG   (   47):     aef10764 4603447a 30b7f240 20069001 2c00e7bd

I/DEBUG   (   47):     aef10774 69a3d033 2b0260e6 61276826 3080f446

I/DEBUG   (   47):     aef10784 46286020 f7fdd114 6b26e960 634cf8c0

I/DEBUG   (   47):     aef10794 f7fd4628 6b62e95a 91082100 46069207

I/DEBUG   (   47):     aef107a4 90096be0 f7ffa807 f506fe8b e0337054

I/DEBUG   (   47):     aef107b4 e950f7fd f8c06b21 46281498 e94af7fd

I/DEBUG   (   47):     aef107c4 22006be3 93099208 6b604606 a8079007

I/DEBUG   (   47):     aef107d4 fe76f7ff 409cf206 f8d8e01e 46281000

I/DEBUG   (   47):     aef107e4 2a02698a f7fdd10c f8c0e930 4628434c

I/DEBUG   (   47):     aef107f4 e92af7fd 94099408 f5009407 e00b7054

I/DEBUG   (   47):     aef10804 e928f7fd 4498f8c0 f7fd4628 9408e924

I/DEBUG   (   47):

I/DEBUG   (   47): memory map around fault addr fffffffe:

I/DEBUG   (   47):     ffff0000-ffff1000 r-x [vectors]

I/DEBUG   (   47):     (no map for address)

I/DEBUG   (   47):     (no map above)

I/BootReceiver(  359): Copying /data/tombstones/tombstone_04 to DropBox (SYSTEM_

TOMBSTONE)

D/dalvikvm(  359): GC_FOR_ALLOC freed 211K, 11% free 5769K/6436K, paused 83ms, t

otal 85ms

I/dalvikvm-heap(  359): Grow heap (frag case) to 5.875MB for 181730-byte allocat

ion

D/dalvikvm(  359): GC_FOR_ALLOC freed 2K, 11% free 5944K/6616K, paused 80ms, tot

al 80ms

D/dalvikvm(  359): GC_FOR_ALLOC freed 156K, 12% free 6036K/6796K, paused 131ms,

total 135ms

D/dalvikvm(  359): GC_FOR_ALLOC freed <1K, 10% free 6125K/6796K, paused 84ms, to

tal 84ms

I/dalvikvm-heap(  359): Grow heap (frag case) to 6.527MB for 500416-byte allocat

ion

D/dalvikvm(  359): GC_FOR_ALLOC freed 0K, 10% free 6614K/7288K, paused 90ms, tot

al 90ms

D/Zygote  (   50): Process 976 terminated by signal (11)

I/ActivityManager(  359): Process ca.redcar.memory (pid 976) has died.

D/        (  359): HostConnection::get() New Host Connection established 0xb7b03

b70, tid 374

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/Effect_Tick.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Eff

ect_Tick.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressStandard.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressStandard.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressSpacebar.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressSpacebar.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressDelete.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressDelete.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressReturn.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressReturn.ogg

E/SoundPool(  359): error loading /system/media/audio/ui/KeypressInvalid.ogg

W/AudioService(  359): Soundpool could not load file: /system/media/audio/ui/Key

pressInvalid.ogg

W/AudioService(  359): onLoadSoundEffects(), Error -1 while loading samples

W/InputMethodManagerService(  359): Window already focused, ignoring focus gain

of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b3f09bd0 attribute=n

ull, token = android.os.BinderProxy@b3e79240

D/dalvikvm(  505): GC_CONCURRENT freed 331K, 14% free 3337K/3868K, paused 80ms+5

ms, total 143ms

Your first potential problem is using closures/anonymous functions in your addEventListener/removeEventListener:

btnEasy:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)
btnMedium:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)
btnHard:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)
btnVeryHard:removeEventListener(“tap”, function() gotoNextScene(DIFF_EASY) end)

the problem here is that event listeners store the event type (i.e. “tap”) and the address of the function it supposed to call in a table.  When you do a closure you get an address to the function created in the addEventListener().  Then when you call removeEventListener, it gets an address for the closure function and that’s a different address, so it can’t match it up with what’s in the saved table.

But likely what is crashing you is these lines in enterScene()

storyboard.purgeScene(“memory”)
storyboard.purgeScene(“guess”)

Perhaps something is getting destroyed in memory.lua or guess.lua that either has a transition still running against it, something being effected by a timer or a Runtime event, physics collision that’s still going on (you can turn your physics hybrid display mode on for that one), any thing that would have an onComplete function that’s getting called.

The fact that you see the scene for a brief second means you are getting to the enterScene() function and there really isn’t much else that would crash your app otherwise.

Rob