Why does my app crash?


#1

Ok, so I have an app that has 25 buttons in the home screen. When you click on one of those buttons (button No1 - button No25) it retrieves an image URL from firebase and opens another screen which shows the image.

When I open the app it normally displays the splash screen (screen1) and after 2 seconds the screen1 closes and a screen called “Home” opens. If I stay idle it wont crash, but if i open another screen, even if i immediately close it, it crashes sooner or later.

Does anyone have a clue on what might be the cause of that?


#2

You forgot to include a screenshot of your blocks. Without it we can’t possibly know what’s wrong with your code.


#3

my guess is, you are switching screens not correctly, see tip 1 here, how to do it…


Taifun


#4

Well, the app’s blocks are a lot. I think more than 1k. I will try to find a solution and if it doesn’t work I will try to show you screenshots


#5

I don’t think there is a problem with the screens. In an older version of the app the crashing issue didn’t exist. The things that changed are:

-Switched from fusion tables to firebase
-Added FABs (even with one FAB only, it crashes)
-Replaced a button that opened a screen with the FABs


#6

You say your app crashes when you change screens, so post the blocks that you use to change screens only.
Also if you didn’t, read the post @Taifun gave you. Most of the times it solves the problems with many screens.


#7

use logcat to find out more about the runtime error


Taifun


#8

This is how I open the screen called “More” from the main screen (“Home”)

This is how I close both the “More” and “Base” screens (by clicking a button which says “Back”)

And this is how I open screen “Base” from screen “Home”


#9

those blocks look fine,
you might want to use logcat now…

Taifun


#10

So the only thing I need to install is the app Inventor software? If so then I’ll try it out and let you know if I come across any issues


#11

I connected my phone via USB but in the cmd it says:

  • waiting for device -

EDIT: it found my device but I think I might be doing something wrong


#12

Could my app crash because I use many high quality images?


#13

Probably yes, what are your sizes of your images in px…


#14

They vary, but the maximum width is 555px and height 375 and I have 19 of them.


#15

Depending on how you use these images for me it sounds too big.

  • all images at once
  • on screen size fixed or responsive
  • how much of the screen does the image take

by @Italo: First, you need to understand that the file size of an image is not the amount of memory it uses when it’s being displayed. The file size is the compressed size, much like a zip or rar file. When viewed, the image needs to be decompressed.
For example, if your image says its file size is 100 kb, and its dimensions are 1024 x 768, 32 bit color, then that image uses over 3 mb of RAM (not 100 kb!) when you show it on the screen. ((1024 * 768 ) * 32) / 8 = 3,145,728 kb (3 mb)
Now, this is a mistake most people make when using arrangements as “virtual screens”: They set different image components with their images loaded but hidden, instead of having only one image component and changing the picture according to the user’s selection or app events, not knowing that apparently the hidden image components are also using the ram, (yes, even though they are invisible!).

do you have any screenshots of your app so we can see what it looks like.


#16

That post by @Italo helped actually. I read about setting images to invisible and setting them to none and I experimented in my app. After a while I found out that I had a web viewer inside an arrangement and instead of setting the viewer to (in)visible I only did that with the arrangement. For now the crash problem is fixed. :smiley:


#17

It would be great if you mark it as solved then…


split this topic #18

A post was split to a new topic: Help with Account Manager extension please