App FC after a while

howto

#1

I’m making an app with multiple games for a school project. It contains 12 screens (8 of them are games). I’m using the screen manager method (https://puravidaapps.com/manager.php) for not running out of memory, but sometimes app force closes when opening/closing screens.

I’ve tried to use logcat to find out the problem but it just shows the process stopped with no further information.


#2

Can you post it here

/Boban


#3

Log_2019-05-04_17-17-44.txt (12.7 KB)

Last lines are from the app restarting itself after force closing (I’m using MIUI, but the error occurs same in AOSP Android 7.1, Android 8.1 and Android 9.0)


#4

Unfortunately, I can’t help much here as de logs are damn confusing to read…

However, it complains a lot about these

  • Slow main thread
  • Slow bitmap uploads

Btw, how large are your images

/Boban


#5

Some of them are large (max 1080px as width), but most of them are not displayed at full size (except for the background images present in the 8 games).


#6

Your images may be too big for the phone to handle. I always use the image as if the phone has a 1280 x 720 px display. So if you want your image to have a height of 20% of the screen, then the image height should be 1280 * 20% = 256 px. If you prioritize the width, then use 720 instead.

Another thing to improve the performance, is to set the images you are not displaying to “none”, so they don’t take resources from the phone. For example, if in a layout you are using an image, set the picture to “none” when you switch the layout.

One last thing, is to set the background picture and all the images to “none” when closing a screen.


#7

AI2 and it’s clones (except one) are designed to work at baseline of (160), you can read more here how to handle the image sizes

/Boban