Crash in Kindle Fire

Hi.
Amazon Appstore Account Team has denied my Kindle Fire game because:

Pressing the soft-key menu button casuse your app to crash in a Kindle Fire. It was found to be incompatible due to issues with the app’s interaction with the Kindle Fire soft keys or hibernation feature. Such issues may include force closes, crashes, loss of user progress or state, an unrecoverable black screen, and problems with audio.

Catlog:

02-07 13:15:03.256 D/ActivityManager( 1383): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 pkg=my.game.for.kindlefire cmp=my.game.for.kindlefire/com.amy.game.for.kindlefirensca.corona.CoronaActivity } from pid 7669
02-07 13:15:03.326 I/ActivityManager( 1383): Start proc my.game.for.kindlefire for activity my.game.for.kindlefire/com.ansca.corona.CoronaActivity: pid=12643 uid=10041 gids={3003}
02-07 13:15:03.474 I/LAB126 ( 1483): StatusBarService hears intent. action: com.lab126.intent.TOP_WINDOW_CHANGED
02-07 13:15:03.474 I/LAB126 ( 1483): window changed
02-07 13:15:03.474 I/LAB126 ( 1483): don’t set softkey config for ‘Starting…’ window
02-07 13:15:03.607 I/ActivityThread(12643): Pub my.game.for.kindlefire.files: com.ansca.corona.FileContentProvider
02-07 13:15:03.638 D/ContentProvider(12643): Videos folder exist
02-07 13:15:03.638 D/ContentProvider(12643): Pictures folder exists
02-07 13:15:03.646 I/ActivityThread(12643): Pub my.game.for.kindlefire.ppy_cache: com.papaya.social.PPYSocialContentProvider
02-07 13:15:03.662 D/ContentProvider(12643): Videos folder exist
02-07 13:15:03.662 D/ContentProvider(12643): Pictures folder exists
02-07 13:15:03.670 D/dalvikvm(12643): Trying to load lib /data/data/my.game.for.kindlefire/lib/libopenal.so 0x40517210
02-07 13:15:03.685 D/dalvikvm(12643): Added shared lib /data/data/my.game.for.kindlefire/lib/libopenal.so 0x40517210
02-07 13:15:03.685 D/dalvikvm(12643): Trying to load lib /data/data/my.game.for.kindlefire/lib/libmpg123.so 0x40517210
02-07 13:15:03.693 D/dalvikvm(12643): Added shared lib /data/data/my.game.for.kindlefire/lib/libmpg123.so 0x40517210
02-07 13:15:03.693 D/dalvikvm(12643): No JNI_OnLoad found in /data/data/my.game.for.kindlefire/lib/libmpg123.so 0x40517210, skipping init
02-07 13:15:03.693 D/dalvikvm(12643): Trying to load lib /data/data/my.game.for.kindlefire/lib/libvorbisidec.so 0x40517210
02-07 13:15:03.693 D/dalvikvm(12643): Added shared lib /data/data/my.game.for.kindlefire/lib/libvorbisidec.so 0x40517210
02-07 13:15:03.693 D/dalvikvm(12643): No JNI_OnLoad found in /data/data/my.game.for.kindlefire/lib/libvorbisidec.so 0x40517210, skipping init
02-07 13:15:03.693 D/dalvikvm(12643): Trying to load lib /data/data/my.game.for.kindlefire/lib/libalmixer.so 0x40517210
02-07 13:15:03.701 D/dalvikvm(12643): Added shared lib /data/data/my.game.for.kindlefire/lib/libalmixer.so 0x40517210
02-07 13:15:03.701 D/dalvikvm(12643): No JNI_OnLoad found in /data/data/my.game.for.kindlefire/lib/libalmixer.so 0x40517210, skipping init
02-07 13:15:03.701 D/dalvikvm(12643): Trying to load lib /data/data/my.game.for.kindlefire/lib/libcorona.so 0x40517210
02-07 13:15:03.732 D/dalvikvm(12643): Added shared lib /data/data/my.game.for.kindlefire/lib/libcorona.so 0x40517210
02-07 13:15:03.888 D/dalvikvm(12597): GC_CONCURRENT freed 670K, 48% free 3591K/6791K, external 1115K/1627K, paused 2ms+3ms
02-07 13:15:04.123 I/ActivityManager( 1383): Displayed my.game.for.kindlefire/com.ansca.corona.CoronaActivity: +798ms
02-07 13:15:04.123 I/LAB126 ( 1483): StatusBarService hears intent. action: com.lab126.intent.TOP_WINDOW_CHANGED
02-07 13:15:04.123 I/LAB126 ( 1483): window changed
02-07 13:15:04.146 W/InputManagerService( 1383): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@40808870 (uid=32013 pid=7669)
02-07 13:15:04.154 D/libEGL (12643): loaded /system/lib/egl/libGLES_android.so
02-07 13:15:04.154 D/libEGL (12643): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
02-07 13:15:04.170 D/libEGL (12643): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
02-07 13:15:04.177 D/libEGL (12643): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
02-07 13:15:04.279 D/dalvikvm(12643): Note: class Landroid/opengl/GLWrapperBase; has 211 unimplemented (abstract) methods
02-07 13:15:04.451 D/dalvikvm(12643): GC_FOR_MALLOC freed 333K, 48% free 3069K/5831K, external 847K/1181K, paused 27ms
02-07 13:15:04.513 I/dalvikvm(12643): Total arena pages for JIT: 11
02-07 13:15:04.560 D/dalvikvm(12643): GC_FOR_MALLOC freed 46K, 47% free 3243K/6023K, external 847K/1181K, paused 29ms
02-07 13:15:04.654 D/dalvikvm(12643): GC_EXTERNAL_ALLOC freed 313K, 49% free 3178K/6215K, external 847K/1181K, paused 32ms
02-07 13:15:04.724 D/dalvikvm(12643): GC_FOR_MALLOC freed 182K, 48% free 3294K/6215K, external 1447K/1959K, paused 20ms
02-07 13:15:04.724 I/dalvikvm-heap(12643): Grow heap (frag case) to 7.591MB for 614416-byte allocation
02-07 13:15:04.748 D/dalvikvm(12643): GC_FOR_MALLOC freed <1K, 44% free 3893K/6855K, external 1447K/1959K, paused 21ms
02-07 13:15:04.826 D/dalvikvm(12597): GC_CONCURRENT freed 567K, 48% free 3585K/6791K, external 1115K/1627K, paused 2ms+2ms
02-07 13:15:04.943 D/dalvikvm(12643): GC_CONCURRENT freed 940K, 47% free 3876K/7239K, external 847K/1359K, paused 5ms+2ms
02-07 13:15:05.138 D/dalvikvm(12643): GC_CONCURRENT freed 644K, 46% free 3910K/7239K, external 847K/1359K, paused 2ms+6ms
02-07 13:15:05.224 D/dalvikvm(12643): GC_FOR_MALLOC freed 863K, 54% free 3398K/7239K, external 847K/1359K, paused 25ms
02-07 13:15:05.224 I/dalvikvm-heap(12643): Grow heap (frag case) to 6.626MB for 87396-byte allocation
02-07 13:15:05.240 D/dalvikvm(12643): GC_FOR_MALLOC freed 0K, 53% free 3483K/7367K, external 847K/1359K, paused 21ms
02-07 13:15:05.357 D/dalvikvm(12643): GC_CONCURRENT freed 404K, 51% free 3633K/7367K, external 847K/1359K, paused 2ms+3ms
02-07 13:15:05.474 D/dalvikvm(12643): GC_CONCURRENT freed 647K, 52% free 3589K/7367K, external 847K/1359K, paused 2ms+3ms
02-07 13:15:05.631 D/dalvikvm(12643): GC_CONCURRENT freed 511K, 51% free 3677K/7367K, external 847K/1359K, paused 2ms+3ms
02-07 13:15:05.818 D/dalvikvm(12643): GC_FOR_MALLOC freed 401K, 51% free 3628K/7367K, external 847K/1359K, paused 25ms
02-07 13:15:05.818 I/dalvikvm-heap(12643): Grow heap (frag case) to 7.767MB for 1048592-byte allocation
02-07 13:15:05.849 D/dalvikvm(12643): GC_FOR_MALLOC freed <1K, 45% free 4651K/8455K, external 847K/1359K, paused 34ms
02-07 13:15:05.920 D/dalvikvm(12643): GC_CONCURRENT freed <1K, 45% free 4651K/8455K, external 847K/1359K, paused 2ms+2ms
02-07 13:15:06.084 D/dalvikvm( 1383): GC_CONCURRENT freed 1438K, 55% free 5498K/11975K, external 3373K/4212K, paused 3ms+5ms
02-07 13:15:06.857 I/SoundDecoder(12643): ALL MPG123 DECODERS:
02-07 13:15:06.857 I/SoundDecoder(12643): generic
02-07 13:15:06.857 I/SoundDecoder(12643):
02-07 13:15:06.857 I/SoundDecoder(12643): SUPPORTED MPG123 DECODERS:
02-07 13:15:06.857 I/SoundDecoder(12643): generic
02-07 13:15:06.857 I/SoundDecoder(12643):
02-07 13:15:06.857 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:06.857 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:06.881 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:06.881 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:06.888 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:06.888 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:06.896 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:06.896 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:06.904 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:06.904 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:06.927 D/Omap4ALSA( 1291): open called for devices 00000002 in mode 0 channels 00000000…
02-07 13:15:06.967 I/Omap4ALSA( 1291): Using ping-pong!
02-07 13:15:06.967 I/Omap4ALSA( 1291): Buffer size: 4096
02-07 13:15:06.967 I/Omap4ALSA( 1291): Latency: 92879
02-07 13:15:06.967 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:06.967 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:06.974 I/SoundDecoder(12643): WAV: unsupported sample size.
02-07 13:15:06.974 I/SoundDecoder_SetError(12643): WAV: Unsupported sample size.
02-07 13:15:06.974 I/SoundDecoder_SetError(12643): MPG123: Message: I am done with this track.
02-07 13:15:06.998 I/SoundDecoder_SetError(12643): OGG: Not valid Ogg Vorbis data.
02-07 13:15:06.998 I/SoundDecoder_SetError(12643): Unsupported codec
02-07 13:15:07.006 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:07.006 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:07.006 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:07.006 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:07.013 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:07.013 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:07.021 I/Omap4ALSA( 1291): Initialized ALSA PLAYBACK device 'plughw:0,0’
02-07 13:15:07.021 E/AudioHardwareALSA( 1291): RE-OPEN AFTER STANDBY:: took 102 msecs
02-07 13:15:07.029 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:07.029 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:07.037 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:07.037 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:07.037 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:07.037 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:07.045 I/SoundDecoder(12643): WAV: Appears to be uncompressed audio.
02-07 13:15:07.045 I/SoundDecoder(12643): WAV: Accepting data stream.
02-07 13:15:07.060 D/dalvikvm(12597): GC_CONCURRENT freed 606K, 47% free 3648K/6791K, external 1115K/1627K, paused 2ms+4ms
02-07 13:15:07.092 D/dalvikvm(12643): GC_EXTERNAL_ALLOC freed 1069K, 57% free 3639K/8455K, external 847K/1359K, paused 36ms
02-07 13:15:07.170 D/dalvikvm(12643): GC_EXTERNAL_ALLOC freed 601K, 57% free 3639K/8455K, external 847K/1447K, paused 33ms
02-07 13:15:07.279 D/dalvikvm(12643): GC_FOR_MALLOC freed 1158K, 57% free 3638K/8455K, external 1018K/1359K, paused 24ms
02-07 13:15:07.349 D/dalvikvm(12643): GC_FOR_MALLOC freed 514K, 57% free 3638K/8455K, external 1018K/1359K, paused 24ms
02-07 13:15:07.404 D/dalvikvm(12643): GC_FOR_MALLOC freed 514K, 57% free 3638K/8455K, external 1018K/1359K, paused 24ms
02-07 13:15:07.420 I/System.out(12643): WARNING: Could not load font Helvetica. Using default.
02-07 13:15:08.420 D/LAB126 ( 1483): expand softkeys
02-07 13:15:09.912 D/LAB126 ( 1483): got menu button softkey click!
02-07 13:15:09.912 D/LAB126 ( 1483): collapse because of menu
02-07 13:15:09.912 D/LAB126 ( 1483): collapse softkeys
02-07 13:15:09.920 W/KeyCharacterMap(12643): No keyboard for id 0
02-07 13:15:09.927 W/KeyCharacterMap(12643): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
02-07 13:15:09.927 I/Corona (12643): onKeyEvent phase: down
02-07 13:15:09.927 I/Corona (12643): onKeyEvent keyName: menu
02-07 13:15:09.967 I/Corona (12643): onKeyEvent phase: up
02-07 13:15:09.967 I/Corona (12643): onKeyEvent keyName: menu
02-07 13:15:10.045 I/ActivityManager( 1383): Process my.game.for.kindlefire (pid 12643) has died.
02-07 13:15:10.045 I/WindowManager( 1383): WIN DEATH: Window{4079a878 SurfaceView paused=false}
02-07 13:15:10.052 I/WindowManager( 1383): WIN DEATH: Window{4084dd40 my.game.for.kindlefire/com.ansca.corona.CoronaActivity paused=false}
02-07 13:15:10.193 W/InputManagerService( 1383): Got RemoteException sending setActive(false) notification to pid 12643 uid 10041
02-07 13:15:10.263 I/LAB126 ( 1483): StatusBarService hears intent. action: com.lab126.intent.TOP_WINDOW_CHANGED
02-07 13:15:10.263 I/LAB126 ( 1483): window changed
02-07 13:15:10.388 D/dalvikvm(12597): GC_CONCURRENT freed 691K, 48% free 3556K/6791K, external 1101K/1613K, paused 1ms+3ms
02-07 13:15:11.162 D/ActivityManager( 1383): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 pkg=com.nolanlawson.logcat cmp=com.nolanlawson.logcat/.LogcatActivity } from pid 7669
02-07 13:15:11.193 I/dalvikvm(12597): Jit: resizing JitTable from 4096 to 8192
02-07 13:15:11.240 I/LAB126 ( 1483): StatusBarService hears intent. action: com.lab126.intent.TOP_WINDOW_CHANGED
02-07 13:15:11.240 I/LAB126 ( 1483): window changed
02-07 13:15:11.334 W/InputManagerService( 1383): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@40808870 (uid=32013 pid=7669)
02-07 13:15:11.951 D/LAB126 ( 1483): got menu button softkey click!
02-07 13:15:11.951 D/LAB126 ( 1483): collapse because of menu
02-07 13:15:11.951 D/LAB126 ( 1483): collapse softkeys
02-07 13:15:11.990 W/KeyCharacterMap(12597): No keyboard for id 0
02-07 13:15:11.990 W/KeyCharacterMap(12597): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
02-07 13:15:13.084 D/IconMerger( 1483): notification for com.amazon.kindle.otter (1)
02-07 13:15:13.084 D/IconMerger( 1483): notification for com.amazon.venezia (1)
02-07 13:15:13.084 D/IconMerger( 1483): notification for wsj.reader_t3 (1)
02-07 13:15:13.084 D/IconMerger( 1483): notification for com.amazon.kindle (1)
02-07 13:15:13.084 D/IconMerger( 1483): notification for com.android.systemui (1)

I haven’t got a Kindle Fire but I guess my wrong source code is:

-- Key listener  
local function onKeyEvent( event )  
 print("onKeyEvent phase: " .. event.phase)  
 print("onKeyEvent keyName: " .. event.keyName)  
  
 if (event.phase == "UP" and event.keyName == "BACK") or (event.phase == "up" and event.keyName == "back")  
 or  
 (event.phase == "UP" and event.keyName == "MENU") or (event.phase == "up" and event.keyName == "menu")  
 then  
 audio.play( global.tapSound )  
 os.exit()  
 end  
  
 return true  
end  

Any idea? It’s drives me crazy because it’s ok in a lot of Android devices (1.6 to 4.x) and even iOS.

[import]uid: 41145 topic_id: 21824 reply_id: 321824[/import]

Amazon Appstore Team just denied our app for the same reason. Have you found a solution to this problem?

Thanks
[import]uid: 120928 topic_id: 21824 reply_id: 115170[/import]

The function [lua]os.exit()[/lua] will force quit your application. As in it will terminate the app on the spot in a not so nice way (think CTRL+ALT+DEL), which can be interpreted as a crash. You should never call that function in an app.

Instead, you should call [lua]native.requestExit()[/lua]. That function will close the app gracefully. This function is only supported on Android at the moment. It will do nothing on iOS, which is by design since Apple will reject apps that exit themselves. Also, this function is a non-blocking call and will not exit the app immediately, meaning the lines below this function call will be executed until the Android accepts the app exit request.

I hope this helps! [import]uid: 32256 topic_id: 21824 reply_id: 115173[/import]