Memory of the app increasing with time

Hi
I have made a game that uses image sprites and is selected at random, they fall and the user has to tap them to score points
I am facing an issue, the memory of the app increases with time without even playing and shows a runtime error after a couple of minutes.
Can you pls suggest ways to tackle this?
Thank you!

I will guess that you have multiple screens and you are not switching screens correctly. Or you might have slow infinite loop

Use different screens wisely

If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
The recommended method of switching screens in App Inventor
(Thanks Taifun)
 
Also see demo: multiscreen.aia
 

Hi
I have 5 screens in my app
first screen is kind of a splash screen which opens the home screen after a few secs.
second screen is the home screen in which the user can choose(2 buttons) either see the instructions or play the game
the third screen is the main game screen
the fourth screen is the instructions screen, which open when the instruction button on screen 3 or 2 is clicked.
the fifth screen is the game over screen with a high score, score, and option to share.

Then read the advice and documentation and switch screens correctly.

Also see

and


using this code, the screen which I am on, goes to the previous screen just before going to the next intended screen. Is it because of the close screen?
Can you pls suggest what to do?
Thank you!

Yes, and that's normal.

I am testing using AI companion and it looks bad.
Will it be the same in APK ? If yes, is there any other solution by which the current screen doesn't go to previous screen and transition to the next screen looks neat.
Thank you

Companion and APK behave differently in some aspects.

Thanks , I will build APK and check it.
How can I check memory consumption?

The real question is that how you are checking memory consumption with Companion?
Same as above.

I made the APK and my application was crashing, and as suggested above I tried the close screen solution. Now I want to check the memory consumption as I run the app side by side. So looking for suggestions on how to do it.

I also have another query. after implementing the close screen , the screen appears from below , meaning from the bottom of the phone and then rises up. However, after sometime it appears from the side. Can you pls tell why this is happening and if there is a way for the screen to appears from the side only, as when the screen rises from the bottom of the phone it looks weird.

Really? Your image suggests at least 9. Screen9

You can not continuously monitor system memory usage using Blocks.

You said you are closing your Screens. Prove it please by sharing your Block images of your Project.

If closing screens does not cure your issue you probably have a coding issue such as:

  • multiple Clocks firing too frequently or their actions interfere with one another
  • a continuous loop
  • something else no one can guess at

No one can tell without a copy of your aia or an image of your Blocks. :cry:

My screen names are: Screen1, Instruction, homepage, gameover, Screen9
This is my first attempt at making an app so the names are a little weird :))

Depending on your Android version this might help. However you will have to build the apk to test the behavior of the screen animation.
screenAnimation

and

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here App inventor español. Offline. Tutorial. Ejemplos. Instalación. Códigos. Juegos. Curso gratis de App inventor. and here Tutorial Index | imagnity for more tutorials.

Learn about components Component Reference
and visit the Library The MIT App Inventor Library: Documentation & Support Help>Library on the MENU

Export your .aia file and upload it here.

1 Like