My project crashes after 1st-3rd time of playing it. How do I solve this problem?

When I run the project in the emulator, the program functions normally from the first to the third playing, but when it gets to the fourth, either the project will stop the sounds I've added on each button. and then it will stop suddenly. My code has no warnings or errors.

My goal is to run this project smoothly without any errors. I only use LDPlayer to run my APK.

My aia file: My aia - Google Drive



scorescreen

screen2

Thank you so much.

Show your blocks (and upload the aia file to Google Drive and post the link).

1 Like

You should especially make sure that you switch screens correctly. Otherwise, a memory problem can occur and the app will crash (since screens have been opened too often).

See also here:

1 Like

Some of your "sounds" are almost a minute long.

They should be on a Player component instead of the Sound component.

Also, Screens do not like to be switched while music is being played.
They require such operations to have been completed before trying to switch screens.

Fortunately, the Player has blocks to stop playing.

P.S. See screen switching advice in

especially for how to open Screen1.

1 Like

Pleasant day! How do I add this global score block so that it appears on my score screen?

scs

Global variables can't cross screens, since screens are almost like separate apps.

Only TinyDB can cross screens without going to the Internet.

Had you stuck to just one screen and used Arrangements instead of screens, you would not have this problem.

1 Like

you are trying to get the score from another screen using the get start value block. However for this to work you have to pass that score from the other screen using the open another screen with value block...
also usually you use the get start value block during initializing of the screen and not during definition of the global variable...

alternatively use TinyDB to pass information from one screen to another, see also tip 1 here

Taifun

1 Like

Did I do it correctly?
@ABG @Taifun

nc

No

Taifun

1 Like

Thank you so much @Anke, @ABG, and @Taifun

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.