Game has stopped message appear in Android when exit the game and sound component is used (DEF-3568) (SOLVED)

Hello,

I don’t know if it’s a bug or not, maybe my implementation is incorrect. This issue occur on my android device firmware 7.1.2 and 8.1.0. When the sound component is used (playing a background audio) and we exit the game, Game has stopped message will appear.
This issue doesn’t occur when waiting until the background sound is stopped.

I also could reproduce it using the Mobile game template. Log also added on the zip.
Mobile game.zip (1.0 MB)

The main.script content:

function init(self)
	msg.post(".", "acquire_input_focus")
	msg.post("sound#music", "play_sound", {delay = 0, gain = 1})
end

function on_input(self, action_id, action)
	if action_id == hash("touch") and action.pressed then
		print("Touch!")
		msg.post("@system:", "exit", {code = 0})
	end
end

Thanks.

1 Like

Yes, this is a bug. I’ll create a ticket for this issue tomorrow when I’m at the office again. A workaround is to call os.exit(0) instead of msg.post().

1 Like

Thanks for the workaround. I think this issue only occur recently.
At least I could sleep at peace tonight. :grinning:

Created ticket: DEF-3568

2 Likes

Fixed in Defold 1.2.141

3 Likes