[solved] SaveState() crashes App

Holzchopf

Moderator
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
496
When I use SaveState() my App crashes. After a while, the message "APPNAMEHERE isn't responding. Do you want to close it? <Wait> <OK>" appears.

Fun thing is: the state is saved correctly anyway. And can be loaded without any trouble.

Does anyone know what could cause this? Or how to debug such a case?

Thank you
 

muruba

New member
CX Code Contributor
3rd Party Module Dev
Tutorial Author
Patreon Silver
Joined
Jul 5, 2017
Messages
230
Anthing in android logs?
 

MikeHart

Administrator
Joined
Jun 19, 2017
Messages
3,210
And how do you know it is savestate that crashes the app?
 

Holzchopf

Moderator
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
496
Ha! I look old now :oops:

I really thought I had tracked it down to SaveState(). I have something like this:
Code:
        If health < 0 Then
            endtime = ctime + 3000
            If score > highscore Then
                highscore = score
                SaveState(highscore)
            End
            newstate = STATE_END
        End

And since I only remembered it to crash when the highscore was cracked, I concluded it had to be either "highscore = score" or SaveState(highscore). Of course the fact that the score could be loaded later with LoadState() made me curious - but not enough...
Aaaand: Just a minute ago or so it even crashed without a new highscore. The problem is clearly somewhere else.

I'll look into some other bits of code and come back to you later.

Oh and btw: Where would I find those
android logs
?
 

Holzchopf

Moderator
3rd Party Module Dev
Tutorial Author
Joined
Jul 31, 2017
Messages
496
Found it!

Believe it or not:
There's an animation in the main menu. When leaving the menu and starting to actually play, that animation was not correctly reset - meaning I only reset the timer but not it's state (it has states like idle, blend in, be there, blend out)... Now, when starting to play in the exact right moment, this mishap could crash the animation when it came back in later (at the end of the game).

Why this only happened on Android but never on HTML5? Pure coincidence.
Why this only happened when cracking the highscore until this morning? Pure coincidence.

And because of that I opened this thread :rolleyes: But in my defence, as an Android newbie I expected something like
Oh, did you think about granting permission android.permission.DO_NOT_CRASH_AFTER_SAVING_STATE ?

Conclusion: Neither an Android nor a SaveState() related problem.
 
Top Bottom