Unfortunately app stopped

The more components(horizontal & cardview) I add, my app tends to crash on more lower end devices.
This is how my app looks:


It was working fine when I had only 15 levels. When I added 15 more levels some devices started crashing. Now we have 60 levels a lot of users reported this issue. I hope its because of the ram consumption. Anyway to reduce it ?

How many screens are you using in your project ?

just 2… one for splash screen & the other for everything else…

Just 2…a bit hard:astonished:
Anyway when this error occurs.

Just as I updated the app… Now the app eats around 130 MB of RAM, which probably is the reason why it crashes…
what is the standard size for navigation drawer/side menu icon ?
24dp or 18dp?
most of the icons used are oversized… planning to change them to a standard value…

Don’t really know the solution but I also had this problem with my app. I had too many arrangements (only 2 screens as well) and my app would keep crashing and eventually I couldn’t even export it. With my app it got fixed by getting rid of the arrangements and being more efficient but looking at your app it seems like you need your arrangements.

1 Like

Looks like it’s an earning app?:face_with_raised_eyebrow:

Lol… No… It’s a Quiz app :rofl:

1 Like

Can you share the apk here… so we can also test…

I have something you can maybe try. You can put the levels as shown in your screenshot on different pages. So for example have levels 1 to 10 on the first page then 11 to 20 on the next page. This way instead of having different arrangements you can just change the text on the arrangements and program it accordingly. So there is not actually 2 pages, just one page where you change the text. You can save which page the user is on using a variable.

This is the way I kind of fixed mine. I just check what page the user is on and only needed one set of arrangements.

1 Like

As @Saezy said, do not show all levels at the same time, organize them to arrangements. 60 visible components in one screen will definitely crash the app on startup. Also, check your images (arrows) dimensions are 96*96 or below. That’s the optimal size.
Another solution is to make it dynamic, just update the labels on next/previous page button click.

I made a Crasher app before. It only had 20 webviews, each of them went to a site. It crashed on all, yes, all devices.

@Saezy @Robert I dont think it will be that easy… I mean splitting them into multiple pages… coz it has a ‘lock’ function too… a new level will get unlocked once the user successfully completes a level. And it has ‘lock icon’ associated with each button ? Are you guys sure that 60 visible components will crash the app ? will replacing the ‘image icons’ with ‘font icons’ solve my problem ?

Initialize global list to = make a list [LA1, LA2, LA3, LA4, LA5, LA6, LA7]
When View.Page Changed do {
If (View.GetPageChange = "next") {
For each item in list = get global list do {
Initialize local level to segment text (after *level*, until end)
If call TinyDB.GetValue tag = level = "unlocked" {
Set (Image+levelcount).visible to true, else false
}
}
}
}

Also, set the level higher, levelcount+lastelementlevel.
For decreasing, the similar logic

2 Likes

Aren’t the level buttons horizontal arrangements? You can store the page as a variable and use an if statement to make sure that the buttons match the page number and change the texts and if needed also put a lock on it. For example say that the level 15 button is called horizontal_arrangement15 and on page 2 then when the user clicks it you can put the blocks like this: IF page number = 2 AND IF level >= 15 then open level 15.

@Robert @Saezy It has both card views & horizontal arrangements… card view = level button. A level is assigned to each card view… If I change it the everything will get complicated…

Assign the levels to labels’ text, then.

I would like to ask this one more time… are your sure that using a lot of horizontal arrangements (and cardviews) on a single screen will force the app to consume a lot of RAM & will eventually crash the app ?
the method you mentioned is risky in my case & will take a lot of time… I have around 1200 blocks now… So I just wanted to make this sure before I work on it…

I am not entirely sure but for me that fixed the issue. You’d have to wait for someone with more knowledge to let you know. Btw it looks like it will take a long time but it is quite quick and definitely worth. You will have a fraction of the blocks and cards. I had over 17,000 blocks and managed to condense it down to 9000 quickly. Even slower phones can run it now whereas before I couldn’t even run it on an s10.
Hopefully you get an answer though as I don’t exactly know how you have arranged your blocks.

I remember reading a post by taifun. The 2 reasons he mentioned where not properly switching screens & oversized images. He didnt mention about the number of components.

Hi Robert, what is the reason why the app crashes? It would be new to me that the number of components causes this. Post your Crasher app (aia) so that we can reproduce the crash.

Did you run logcat (adb logcat *: E)? If so, post the logcat.txt.

Anke