PDA

View Full Version : Gingerbread crashes



riotrick
01-30-2011, 06:02 AM
I'm running the latest amblingbook player pro (2.06), downloaded from the market.
On my HTC Desire I'm running a gingerbread rom: Oxygen v2.0-RC7, which is an AOSP built android 2.3.2 (gingerbread) rom.

The bookplayer has a few crashes on this (all gingerbread?) rom. One crash occurs when the screen orientation changes. The app just crashes (you go back to your homescreen), no force close or any message is displayed.

Also when I click book summary, I get a force close message.

I've also run the app (a few version earlier) on a android 2.2 (froyo) rom. These issues where not happening there, so they seem to be gingerbread specific.

riotrick
01-31-2011, 05:24 AM
Here is the adb logcat output from the crash when changing the screen orientation:



I/ActivityManager( 128): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.amblingbooks.bookplaye
rpro/com.amblingbooks.player.PlayControl bnds=[5,58][115,188] } from pid 229
D/FlurryAgent( 9921): Starting new session
D/FlurryAgent( 9921): Sending report to: http://data.flurry.com/aar.do
I/AudioService( 128): AudioFocus requestAudioFocus() from android.media.AudioManager@406dade8com.amblingbook s.player.AudioFocus$1@406b4ab0
I/AudioService( 128): Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.amblingbooks.bookplayerpro/com.amblingbooks.player.MediaBroad
castReceiver}
I/StagefrightPlayer( 103): setDataSource('/sdcard/audiobooks/Stieg Larsson - Gerechtigheid/26 - Hoofdstuk 17.mp3')
D/dalvikvm( 9921): GC_EXTERNAL_ALLOC freed 147K, 55% free 2897K/6343K, external 13971K/14534K, paused 46ms
D/dalvikvm( 9921): GC_EXTERNAL_ALLOC freed 16K, 54% free 2918K/6343K, external 14645K/16644K, paused 46ms
I/AudioService( 128): Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.amblingbooks.bookplayerpro/com.amblingbooks.player.MediaBroad
castReceiver}
I/ActivityManager( 128): Displayed com.amblingbooks.bookplayerpro/com.amblingbooks.player.PlayControl: +1s30ms
I/AudioService( 128): Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.amblingbooks.bookplayerpro/com.amblingbooks.player.MediaBroad
castReceiver}
I/AudioService( 128): Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.amblingbooks.bookplayerpro/com.amblingbooks.player.MediaBroad
castReceiver}
I/AudioService( 128): Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.amblingbooks.bookplayerpro/com.amblingbooks.player.MediaBroad
castReceiver}
I/WindowManager( 128): Setting rotation to 1, animFlags=0
I/ActivityManager( 128): Config changed: { scale=1.0 imsi=204/12 loc=nl_NL touch=3 keys=1/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=17}
D/FlurryAgent( 9921): Ending session
D/FlurryAgent( 9921): Continuing previous session
D/dalvikvm( 9921): GC_EXTERNAL_ALLOC freed 187K, 56% free 2852K/6343K, external 25183K/26569K, paused 29ms
D/UpdateService( 9697): rotation (new config = { scale=1.0 imsi=204/12 loc=nl_NL touch=3 keys=1/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=17})
D/dalvikvm( 9921): GC_FOR_MALLOC freed 5K, 56% free 2847K/6343K, external 25232K/26569K, paused 22ms
D/dalvikvm( 9921): GC_EXTERNAL_ALLOC freed 19K, 55% free 2902K/6343K, external 14645K/15245K, paused 31ms
I/AudioService( 128): Remote Control registerMediaButtonEventReceiver() for ComponentInfo{com.amblingbooks.bookplayerpro/com.amblingbooks.player.MediaBroad
castReceiver}
I/AudioService( 128): Remote Control unregisterMediaButtonEventReceiver() for ComponentInfo{com.amblingbooks.bookplayerpro/com.amblingbooks.player.MediaBro
adcastReceiver}
I/AudioService( 128): AudioFocus abandonAudioFocus() from android.media.AudioManager@406dade8com.amblingbook s.player.AudioFocus$1@406b4ab0
W/Service ( 9921): setForeground: ignoring old API call on com.amblingbooks.player.BookPlayer
W/InputManagerService( 128): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$ Proxy@40b466c0 (uid=10070 pid=9921)
D/dalvikvm( 128): GC_CONCURRENT freed 1929K, 41% free 7052K/11783K, external 6273K/7014K, paused 3ms+6ms
D/dalvikvm( 128): GC_EXPLICIT freed 5K, 41% free 7046K/11783K, external 6273K/7014K, paused 92ms
I/WindowManager( 128): Setting rotation to 0, animFlags=1
D/dalvikvm( 9748): GC_CONCURRENT freed 499K, 55% free 3134K/6855K, external 1625K/2137K, paused 2ms+61ms
I/ActivityManager( 128): Config changed: { scale=1.0 imsi=204/12 loc=nl_NL touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=18}
D/UpdateService( 9697): rotation (new config = { scale=1.0 imsi=204/12 loc=nl_NL touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=18})
W/IInputConnectionWrapper( 9921): showStatusIcon on inactive InputConnection
D/FlurryAgent( 9921): Ending session
D/dalvikvm( 229): GC_EXTERNAL_ALLOC freed 526K, 49% free 5083K/9927K, external 11415K/11421K, paused 53ms
D/dalvikvm( 226): GC_CONCURRENT freed 1925K, 58% free 3394K/8071K, external 6144K/7202K, paused 6ms+2ms
D/dalvikvm( 128): GC_EXPLICIT freed 533K, 41% free 6978K/11783K, external 5136K/6106K, paused 117ms

/edit:

I found the solution to this problem as well. If you have the box ticked: "Exit on pause" in the preferences, the app will exit on orientation change. When you untick this option it won't exit.

riotrick
01-31-2011, 05:29 AM
And a logcat output when I click a book in my library. This generates a force close message. The heap size on this rom is 32m.
If you need more / different logs please let me know.


I/ActivityManager( 128): Starting: Intent { cmp=com.amblingbooks.bookplayerpro/com.amblingbooks.player.BookSummary (has extras) } from pid 10048
D/dalvikvm(10048): GC_EXTERNAL_ALLOC freed 119K, 49% free 2970K/5767K, external 23979K/24914K, paused 27ms
E/dalvikvm-heap(10048): 10113600-byte external allocation too large for this process.
E/GraphicsJNI(10048): VM won't let us allocate 10113600 bytes
D/dalvikvm(10048): GC_FOR_MALLOC freed 7K, 49% free 2963K/5767K, external 13203K/23080K, paused 20ms
D/skia (10048): --- decoder->decode returned false
D/AndroidRuntime(10048): Shutting down VM
W/dalvikvm(10048): threadid=1: thread exiting with uncaught exception (group=0x40149560)
D/FlurryAgent(10048): Ending session
E/AndroidRuntime(10048): FATAL EXCEPTION: main
E/AndroidRuntime(10048): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
E/AndroidRuntime(10048): at android.graphics.BitmapFactory.nativeDecodeStream( Native Method)
E/AndroidRuntime(10048): at android.graphics.BitmapFactory.decodeStream(Bitmap Factory.java:460)
E/AndroidRuntime(10048): at android.graphics.BitmapFactory.decodeFile(BitmapFa ctory.java:274)
E/AndroidRuntime(10048): at android.graphics.BitmapFactory.decodeFile(BitmapFa ctory.java:299)
E/AndroidRuntime(10048): at com.amblingbooks.player.BookSummary.updateDisplay( BookSummary.java:415)
E/AndroidRuntime(10048): at com.amblingbooks.player.BookSummary.onResume(BookS ummary.java:282)
E/AndroidRuntime(10048): at android.app.Instrumentation.callActivityOnResume(I nstrumentation.java:1149)
E/AndroidRuntime(10048): at android.app.Activity.performResume(Activity.java:3 833)
E/AndroidRuntime(10048): at android.app.ActivityThread.performResumeActivity(A ctivityThread.java:2085)
E/AndroidRuntime(10048): at android.app.ActivityThread.handleResumeActivity(Ac tivityThread.java:2110)
E/AndroidRuntime(10048): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:1643)
E/AndroidRuntime(10048): at android.app.ActivityThread.access$1500(ActivityThr ead.java:117)
E/AndroidRuntime(10048): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:928)
E/AndroidRuntime(10048): at android.os.Handler.dispatchMessage(Handler.java:99 )
E/AndroidRuntime(10048): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(10048): at android.app.ActivityThread.main(ActivityThread.jav a:3647)
E/AndroidRuntime(10048): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(10048): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(10048): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:839)
E/AndroidRuntime(10048): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:597)
E/AndroidRuntime(10048): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 128): Force finishing activity com.amblingbooks.bookplayerpro/com.amblingbooks.player.BookSummary
W/ActivityManager( 128): Force finishing activity com.amblingbooks.bookplayerpro/com.amblingbooks.player.Library
W/ActivityManager( 128): Activity pause timeout for HistoryRecord{4069e508 com.amblingbooks.bookplayerpro/com.amblingbooks.player.BookSummary}
D/dalvikvm( 128): GC_CONCURRENT freed 2016K, 40% free 7104K/11783K, external 5531K/6106K, paused 3ms+6ms


After reading this log it looked like this was caused by the cover art jpg. This was indeed a fairly large jpg file. I resized it and put the smaller version in there. That solved this problem.

Imho the app shouldn't crash if there is a large cover jpg, but at least I can work around this problem.

Howard
02-05-2011, 01:16 AM
Thanks for posting the information about the problems you have seen.

I will check to see if there is anything we can do about the Gingerbread crash on a screen rotation when you have the "Exit on pause" option selected. The Android OS destroys the activity instance and then recreates it again in the new orientation. When it destroys the Activity and you have the exit on pause option selected the player will shut down all the way during the destroy. It sounds like something has changed in the Gingerbread OS which does not handle the application shutting down during the rotation.

I looked at the code in BookSummary.updateDisplay which calls BitmapFactory.decodeFile and found that we already have a try/catch block around the call to decodeFile. Apparently with the large image size you are using the Android OS did not throw an exception when the decodeFile call ran out of heap space, but instead just shut down the VM. I am not sure what else we could do here to try and prevent the VM from getting shutdown when it runs out of memory because of a large image file like this.

riotrick
02-11-2011, 03:56 AM
I am not sure what else we could do here to try and prevent the VM from getting shutdown when it runs out of memory because of a large image file like this.
Maybe check the filesize before running the BitmapFactory.decodeFile?

Also when you look at the logs:



W/dalvikvm(10048): threadid=1: thread exiting with uncaught exception (group=0x40149560)
D/FlurryAgent(10048): Ending session
E/AndroidRuntime(10048): FATAL EXCEPTION: main


It looks like an exception is being thrown, but it is not caught by your catch block.

Howard
02-13-2011, 02:57 PM
The uncaught exception message is puzzling.

We are using a generic "catch (Exception e)" catch statement which I believe should get called for all exception types.