- Home /
Problem with terminating apps on Android
Okay, I got this weird problem I just cant figure out.
I am developing a game for iOS and Android, and it works perfectly on iOS. It also works perfectly on my HTC and my Sony Xperia, however on my Galaxy S3 it does not.
Or well it does. It works fine UNTIL you force quit the game. After you force quit and start the app again, it loads the first scene (my menu) like it should, but when I hit "new game", which loads the first scene in the actual game. It crashes.
The crash log gives me this me this: (and a lot more, but this seems to be the key message?)
I/DEBUG ( 1910): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I dont know what it means, but general googling seems to say it's something about memory, but I am pretty clueless as the what the actual problem can be, since it ONLY happens after you force quit the game, and only on one of three devices I have tested it on. It doesnt always happen either, but at least 50% of the time after a force quit, it crashes when restarting, somewhere while loading the main game scene. It's really strange...
I am thinking something weird is happening when the App is force quit? But what? And is there a way to control it?
Will running something in: OnApplicationQuit() help? Or is that not called when you force quit something?
I mean force quitting is the way to quit applications on Android devices isnt it? Thats what most people do? So it's probably bad if it means a crash the next time you run the game.
Have anyone experienced something similar, or a similar crash log message? And have an idea what to do about it?
Thanks in advance
Hey, I'm pretty new at this, but there are a number of developer settings on the phone that allow you to see the memory usage, etc, of the app being run. Perhaps working with those may shed some light on the problem.
Be careful though. I've done something with the settings in my phone that has rendered use of unity remote useless. So, I need to dload a full .apk to do any testing.
Hey,
Yeah, that might shed some light. I actually havent investigated those options, but I am checking them out now.
$$anonymous$$aybe it will provide some helpful insight.
It's still so strange that it only crashes after a force quit. I wish I knew what force quitting an App in Android really does. It does say "Force quitting an application may cause problems".... but I never noticed a problem in other apps when force quitting... and not on other devices either...
I am no expert on Android in general, since I am mainly an iPhone user, do you know if I should include some type of function or something so that App quits "properly", whenever a user ter$$anonymous$$ates it??
No I don't. I've only recently implemented the Application.Quit() on Escape key pressed. Is there a way to detect the "Force Quit" key on the phone similar to the $$anonymous$$eyCode.Escape for a normal exit? If so we could use the same exit script and add the $$anonymous$$eyCode."ForceQuit$$anonymous$$ey". (I think it may be the Home button.)
I'm sitting here playing with the game I've creating for the android (running on Galaxy S4). When I "force quit" the app is placed in a queue of sorts (running apps). Then If I "really" want to force quit that app I get the message your talking about ...may cause errors... So, if I don't do the second step the app is still in memory and can be run like normal when pressing the icon again. So, I'm not sure about the galaxy S3.
If found this link regarding debug on Android... http://docs.unity3d.com/Documentation/$$anonymous$$anual/android-bugreporting.html
I know this is not helping. I'll let you know if I learn something of value.
No matter if I force quit from the applications menu (where you get the warning message), or if I use an external activity monitor app to force quit, or if hold down the home button and then "swipe" the application, the error remains the same when restarting it.
So I guess no matter how you force quit it, it's handled more or less the same way, since it gives me the same error.
I've researched if it's possible to detect force quits, and it doesnt seem like it is... since it just ter$$anonymous$$ates to current process without warning or calling anything.
Hm.
How are you doing a force quit and more importantly why? I'm finding that there are two ways to exit an app cleanly (remove it from memory), first with code by using the Application.Quit on Escape button detected and Second, manually clear the applications loaded list on the phone.
As you know, when the user presses the home button (Bottom center) to exit the game/app and returns to their "home screen", the app is still in memory. The user can then either restart the game from the list of apps in memory (Press-hold the Home key to get the list) or they can restart the game by pressing the app Icon. If they restart the app that is already in memory then note that the unity power up screen does not display as it does when the app is first started up and initially loaded into memory.
So, my question is why is there a need to force quit the game at all? Is that a limitation of the S3? That is, does the S3 force quit the app when the home key is pressed? If yes, then that really sucks. If not then I would use either of the two clean methods for exiting the app from memory.
So, my guess is that by doing a force quit there are some residual aspects of the game (like a link to the second scene or something bad, as they warn..) still in memory, so that when you restart the game a memory error occurs.
Please let me know if the S3 does a force quit on Home key, since my game will be running on the S3 at some point. Thanks.
Answer by unimechanic · Feb 25, 2014 at 06:52 PM
Please submit a bug report with a minimal sample project (if possible, will be very helpful) that reproduces this problem, following these guidelines and additional information:
http://unity3d.com/BugReportingFAQ
http://blogs.unity3d.com/2013/10/28/bug-reports-incidents-and-some-bashing/
http://issuetracker-staging.unity3d.com/
The bug reporting tool is next to the Unity executable if you can't run it from the editor. Our QA team will review the issue as soon as possible, and then assign it to our developers. Having the bug report is the only way this problem can be fixed.