I am investigating some crashes and ANRs in our game appearing after user quits game with back button
So lately we had few problems with common WTR:
- Run game.
- Quit game with back button (our custom code calls Application.Quit()) (Input.backButtonLeavesApp works the same way)
- Immediately run game again
- Something bad happens
a) On Oreo devices it shows black screen for ~8 seconds (there is no black screen for first launch)
b) It crashes because 3rd party activity (OneSignal) can’t do something in wrong activity state
c) It freezes (ANR) because other 3rd party library do something
All of the problems are not reproduced if you press Home button or completely kill game in task launcher
I found temporary workarounds to crash and ANR problems but I think “black screen” is a key to understand what’s going on here. So I started to remove all native plugins and calls to “AndroidJavaObject” in our game hoping to remove black screen issue at some point.
I removed everything somehow connected to native plugins and 8 seconds black screen is still there.
I tried to create new unity application and I don’t see the bug in fresh application.
I tried to check other unity games, for example Angry birds evolution and it’s there.
I suppose the only thing we share with Angry Birds Evolution is Unity game engine, so it may be the bug inside Unity.
Can somebody from Unity elaborate on that and help to understand what it the difference between first launch and onRestart?
WTR:
- Use the device with 8.0+ Android. I used Google Pixel.
- Download Angry Birds Evolution https://play.google.com/store/apps/details?id=com.rovio.tnt&hl=en or our game https://play.google.com/store/apps/details?id=com.my.moba.ent
- Go through tutorial, cause Back button doesn’t work in tutorial.
- Press back button, exit the application.
- Immediately run it again.
- See long black/white screen before splash image. Notice on first launch there is no such screen.