I have a game that gets a photo from the user Photo Library.
A lot of users are complaining that the game is restarting after they select a photo from the Album (and this usually happens on the 2nd time that they select a photo).
I was able to reproduce this error and I noticed that his also happens with the Corona Photo Picker Sample app (After selecting 9 times a photo, on the 10th the app restarts)
I found that Android is killing the process so, the app simply restart. I checked if at least the photo was saved (so I could redirect the user and avoid the restart appearance) but that does not happen.
Any ideas to solve that or at least a work-around for that bug?
Log while at the Album and when the process is killed:
03-19 14:26:39.962: D/dalvikvm(676): GC\_EXPLICIT freed 166K, 51% free 3173K/6471K, external 1596K/2108K, paused 97ms 03-19 14:26:39.993: W/GLThread(19105): onSurfaceCreated 03-19 14:26:39.993: I/RenderView(19105): OSC 03-19 14:26:40.005: D/LocalDataSource(19105): registerContentObserver 03-19 14:26:40.083: D/MediaFeed(19105): Thread End 03-19 14:26:40.091: I/RenderView(19105): \>\>\>\>\>OSC 03-19 14:26:40.091: W/GLThread(19105): onSurfaceChanged(480, 800) 03-19 14:26:40.091: I/RenderView(19105): First Draw 03-19 14:26:40.142: I/GLThread(19105): sending render notification tid=128 03-19 14:26:40.145: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.145: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.145: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.149: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.153: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.153: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.157: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.161: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.208: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.212: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.212: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.212: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.220: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.220: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.224: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.227: I/MediaItemTexture(19105): Decoding End 03-19 14:26:40.282: I/ActivityManager(523): Process com.redbeachgames.renato.PhotoPicker (pid 19078) has died. 03-19 14:26:40.282: I/ActivityManager(523): Low Memory: No more background processes. 03-19 14:26:40.282: I/WindowManager(523): WIN DEATH: Window{40954908 SurfaceView paused=false} 03-19 14:26:40.290: I/WindowManager(523): WIN DEATH: Window{409d1c50 com.redbeachgames.renato.PhotoPicker/com.ansca.corona.CoronaActivity paused=false} 03-19 14:26:40.333: I/MediaItemTexture(19105): Decoding Start 03-19 14:26:40.333: I/MediaItemTexture(19105): Decoding End
Log after selecting a photo (and going back to killed app):
03-19 14:26:41.341: I/InputReader(523): dispatchTouch::touch event's action is 0 03-19 14:26:41.341: I/InputDispatcher(523): Delivering touch to current input target: action: 0 03-19 14:26:41.411: I/InputReader(523): dispatchTouch::touch event's action is 1 03-19 14:26:41.411: I/InputDispatcher(523): Delivering touch to current input target: action: 1 03-19 14:26:41.427: D/TEST(19105): onSingleTapUp210 03-19 14:26:41.427: D/Gallery(19105): performReturn : result = Intent { dat=content://media/external/images/media/78 } 03-19 14:26:41.427: I/GLThread(19105): onPause tid=128 03-19 14:26:41.427: I/Main thread(19105): onPause waiting for mPaused. 03-19 14:26:41.431: I/Main thread(19105): onPause waiting for mPaused. 03-19 14:26:41.446: I/GLThread(19105): mPaused is now true tid=128 03-19 14:26:41.446: I/GLThread(19105): releasing EGL surface because paused tid=128 03-19 14:26:41.446: W/EglHelper(19105): destroySurface() tid=128 03-19 14:26:41.462: W/EglHelper(19105): finish() tid=128 03-19 14:26:41.489: I/GLThread(19105): releasing EGL context because paused tid=128 03-19 14:26:41.489: I/RenderView(19105): OnPause RenderView com.cooliris.media.RenderView@40590a80 03-19 14:26:41.489: E/SensorManager(19105): unregisterListener:: all sensors, listener = com.cooliris.media.RenderView@40590a80 03-19 14:26:41.493: D/WakeLock(19105): onpause mCheckDecodeWakeLock : result = false 03-19 14:26:41.493: D/StatusBarManagerService(523): manageDisableList what=0x0 pkg=com.cooliris.media 03-19 14:26:41.575: I/GLThread(19105): noticed surfaceView surface lost tid=128 03-19 14:26:41.622: D/LocalDataSource(19105): unregisterContentObserver; mObserver = com.cooliris.media.LocalDataSource$1@405469b8 03-19 14:26:41.622: D/LocalDataSource(19105): unregisterContentObserver; mObserver = com.cooliris.media.LocalDataSource$1@405469b8 03-19 14:26:41.634: I/Gallery(19105): onDestroy 03-19 14:26:41.657: I/CacheService(19105): restartThread() threadRef = null, name = CacheRefreshDirtySets 03-19 14:26:41.665: I/CacheService(19105): restartThread() threadRef = null, name = ThumbnailRefresh 03-19 14:26:41.681: I/ActivityThread(19377): Pub com.redbeachgames.renato.PhotoPicker.files: com.ansca.corona.storage.FileContentProvider 03-19 14:26:41.727: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/liblua.so 0x40514a98 03-19 14:26:41.735: D/dalvikvm(19377): Added shared lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/liblua.so 0x40514a98 03-19 14:26:41.735: D/dalvikvm(19377): No JNI\_OnLoad found in /data/data/com.redbeachgames.renato.PhotoPicker/lib/liblua.so 0x40514a98, skipping init 03-19 14:26:41.735: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libjnlua5.1.so 0x40514a98 03-19 14:26:41.739: D/dalvikvm(19377): Added shared lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libjnlua5.1.so 0x40514a98 03-19 14:26:41.743: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libjnlua5.1.so 0x40514a98 03-19 14:26:41.743: D/dalvikvm(19377): Shared lib '/data/data/com.redbeachgames.renato.PhotoPicker/lib/libjnlua5.1.so' already loaded in same CL 0x40514a98 03-19 14:26:41.743: I/dalvikvm(19377): threadid=1: recursive native library load attempt (/data/data/com.redbeachgames.renato.PhotoPicker/lib/libjnlua5.1.so) 03-19 14:26:41.743: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libopenal.so 0x40514a98 03-19 14:26:41.770: I/OpenAL\_SLES(19377): alc\_opensles\_init 03-19 14:26:41.770: D/dalvikvm(19377): Added shared lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libopenal.so 0x40514a98 03-19 14:26:41.770: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libmpg123.so 0x40514a98 03-19 14:26:41.782: D/dalvikvm(19377): Added shared lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libmpg123.so 0x40514a98 03-19 14:26:41.782: D/dalvikvm(19377): No JNI\_OnLoad found in /data/data/com.redbeachgames.renato.PhotoPicker/lib/libmpg123.so 0x40514a98, skipping init 03-19 14:26:41.782: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libvorbisidec.so 0x40514a98 03-19 14:26:41.782: D/dalvikvm(19377): Added shared lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libvorbisidec.so 0x40514a98 03-19 14:26:41.782: D/dalvikvm(19377): No JNI\_OnLoad found in /data/data/com.redbeachgames.renato.PhotoPicker/lib/libvorbisidec.so 0x40514a98, skipping init 03-19 14:26:41.782: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libalmixer.so 0x40514a98 03-19 14:26:41.786: D/dalvikvm(19377): Added shared lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libalmixer.so 0x40514a98 03-19 14:26:41.786: D/dalvikvm(19377): No JNI\_OnLoad found in /data/data/com.redbeachgames.renato.PhotoPicker/lib/libalmixer.so 0x40514a98, skipping init 03-19 14:26:41.786: D/dalvikvm(19377): Trying to load lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libcorona.so 0x40514a98 03-19 14:26:41.958: D/dalvikvm(19377): Added shared lib /data/data/com.redbeachgames.renato.PhotoPicker/lib/libcorona.so 0x40514a98 03-19 14:26:42.048: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 1 03-19 14:26:42.052: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 2 03-19 14:26:42.052: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 3 03-19 14:26:42.052: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 4 03-19 14:26:42.052: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 5 03-19 14:26:42.052: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 6 03-19 14:26:42.052: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 7 03-19 14:26:42.056: D/SensorManager(19377): ====\>\>\>\>\>Num Sensor: 0 03-19 14:26:42.239: E/SensorManager(19377): registerListener :: handle = 0 name= BMA023 Acceleration Sensor delay= 200000 Listener= android.view.OrientationEventListener$SensorEventListenerImpl@4058f5d0 03-19 14:26:42.239: E/SensorManager(19377): =======\>\>\>Sensor Thread RUNNING \<\<\<======== 03-19 14:26:42.243: E/SensorManager(19377): reg :: handle = 0 03-19 14:26:42.298: D/libEGL(19377): loaded /system/lib/egl/libEGL\_POWERVR\_SGX540\_120.so 03-19 14:26:42.321: D/libEGL(19377): loaded /system/lib/egl/libGLESv1\_CM\_POWERVR\_SGX540\_120.so 03-19 14:26:42.337: D/libEGL(19377): loaded /system/lib/egl/libGLESv2\_POWERVR\_SGX540\_120.so 03-19 14:26:42.427: D/dalvikvm(19377): Note: class Landroid/opengl/GLWrapperBase; has 211 unimplemented (abstract) methods 03-19 14:26:42.431: V/GLSurfaceView(19377): glGetString(7937) returns PowerVR SGX 540; 03-19 14:26:42.474: V/Corona(19377): \> Class.forName: network.LuaLoader 03-19 14:26:42.474: V/Corona(19377): \< Class.forName: network.LuaLoader 03-19 14:26:42.474: V/Corona(19377): Loading via reflection: network.LuaLoader 03-19 14:26:42.477: I/Corona(19377): Platform: GT-I9000 / ARM Neon / 2.3.6 / PowerVR SGX 540 / OpenGL ES 2.0 03-19 14:26:42.759: V/Corona(19377): \> Class.forName: CoronaProvider.licensing.google.LuaLoader 03-19 14:26:42.759: V/Corona(19377): \< Class.forName: CoronaProvider.licensing.google.LuaLoader 03-19 14:26:42.763: V/Corona(19377): Loading via reflection: CoronaProvider.licensing.google.LuaLoader 03-19 14:26:42.770: I/Corona(19377): display.contentScale x,y: 0.60000002384186 0.60000002384186
UPDATE: The discussion about this problem ended happening on another (older) thread here. It appears that the problem is a memory leak that happens every time the app goes suspended/resumed. Corona is working on that.