App crashes when quickly use!


#1

Hi all!

I am testing my apk app, that has 5 screens, using the recommended method to switching between they, and using small images in order to avoid memory related problems. All is working fine, except for the crashes that the app experiments when I use it quickly (this means, quick “touches” changing from one screen, then other, then another, return to first screen, and so on).

I get the logs, and searched for “FATAL”. Se bellow:

In Moto G - 5.1

I/art (12809): Alloc> concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 6% free, 89MB/96MB, paused 6.123ms total 103.056ms
E/art (12809): Throwing OutOfMemoryError “Failed to allocate a 10036236 byte allocation with 7003227 free bytes and 6MB until OOM”
I/art (12809): Alloc sticky concurrent mark sweep GC freed 5(352B) AllocSpace objects, 0(0B) LOS objects, 6% free, 89MB/96MB, paused 6.262ms total 23.833ms
I/art (12809): Clamp target GC heap from 105MB to 96MB
I/art (12809): Alloc partial concurrent mark sweep GC freed 6(192B) AllocSpace objects, 0(0B) LOS objects, 6% free, 89MB/96MB, paused 6.265ms total 89.236ms
I/art (12809): Clamp target GC heap from 105MB to 96MB
I/art (12809): Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 6% free, 89MB/96MB, paused 6.394ms total 102.477ms
I/art (12809): Forcing collection of SoftReferences for 9MB allocation
I/art (12809): Clamp target GC heap from 105MB to 96MB
I/art (12809): Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 6% free, 89MB/96MB, paused 7.026ms total 107.106ms
E/art (12809): Throwing OutOfMemoryError “Failed to allocate a 10036236 byte allocation with 7003227 free bytes and 6MB until OOM”
I/art (12809): Background sticky concurrent mark sweep GC freed 104211(5MB) AllocSpace objects, 0(0B) LOS objects, 5% free, 90MB/96MB, paused 6.187ms total 67.258ms
E/AndroidRuntime(12809): FATAL EXCEPTION: Thread-5340
E/AndroidRuntime(12809): Process: com.app.name, PID: 12809
E/AndroidRuntime(12809): java.lang.OutOfMemoryError: Failed to allocate a 10036236 byte allocation with 7003227 free bytes and 6MB until OOM
E/AndroidRuntime(12809): at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
E/AndroidRuntime(12809): at android.graphics.Bitmap.nativeCreate(Native Method)
E/AndroidRuntime(12809): at android.graphics.Bitmap.createBitmap(Bitmap.java:838)
E/AndroidRuntime(12809): at android.graphics.Bitmap.createBitmap(Bitmap.java:815)
E/AndroidRuntime(12809): at android.graphics.Bitmap.createBitmap(Bitmap.java:746)
E/AndroidRuntime(12809): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:622)
E/AndroidRuntime(12809): at com.google.appinventor.components.runtime.util.MediaUtil$2.run(MediaUtil.java:476)
E/AndroidRuntime(12809): at java.lang.Thread.run(Thread.java:818)

In Moto G5s Plus - 7.1

06-13 22:38> :52.457 26176 28637 E AndroidRuntime: FATAL EXCEPTION: androidmapsapi-ulcs-1
06-13 22:38:52.457 26176 28637 E AndroidRuntime: Process: com.app.name, PID: 26176
06-13 22:38:52.457 26176 28637 E AndroidRuntime: java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack trace available
06-13 22:38:52.457 26176 26206 I art : Starting a blocking GC Alloc
06-13 22:38:52.457 26176 28637 I art : Starting a blocking GC Alloc
06-13 22:38:52.457 26176 26186 I art : WaitForGcToComplete blocked for 142.098ms for cause Background
[…]
06-13 22:38:54.682 26176 26206 I art : Forcing collection of SoftReferences for 128B allocation
06-13 22:38:54.682 26176 26206 I art : Starting a blocking GC Alloc
06-13 22:38:54.779 26176 26206 I art : Clamp target GC heap from 208MB to 192MB
06-13 22:38:54.779 26176 26206 I art : Alloc concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 192MB/192MB, paused 14.231ms total 97.486ms
06-13 22:38:54.779 26176 26206 W art : Throwing OutOfMemoryError “Failed to allocate a 128 byte allocation with 0 free bytes and 3GB until OOM”
06-13 22:38:54.779 26176 26206 I art : Starting a blocking GC Alloc
06-13 22:38:54.779 26176 26206 I art : Starting a blocking GC Alloc
06-13 22:38:54.828 26176 26206 I art : Alloc sticky concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 192MB/192MB, paused 14.320ms total 48.745ms
06-13 22:38:54.828 26176 26206 I art : Starting a blocking GC Alloc
06-13 22:38:54.882 2409 2410 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
06-13 22:38:54.923 26176 26206 I art : Clamp target GC heap from 208MB to 192MB
06-13 22:38:54.923 26176 26206 I art : Alloc partial concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 192MB/192MB, paused 14.409ms total 94.243ms
06-13 22:38:54.923 26176 26206 I art : Starting a blocking GC Alloc
06-13 22:38:54.943 3143 30251 I ActivityManager: Killing 26176:com.app.name/u0a142 (adj 0): crash

Any ideas?

Regards.


#2

When you click button1 then screen2 will open. Then screen2 when back pressed then screen1 will open.

For this event in screen2 block use
" when screen2 back pressed. close screen2"

For all screens use this blocking.

This will avoid running of screen in background and when you back press a screen that screen should be closed to open another screen fast. And your app will run smoothly without crashing.

Hope this is helps u!


#3

Hi!

I’m using that! For example: I’m in ScreenMenu, and touch a button to go to ScreenDetails (I’m using “close screen with value”). The ScreenMenu will close, and a new screen will open from Screen1, using “Other Screen Closed” and catching the values sent for ScreenMenu.

This login was explained here.

Regards.


#4

Show me screen open and close blocks of screen1 and screen2


#5

that is your error

see tip2 here

Taifun