cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.08k stars 7.05k forks source link

Crash on device during language change in cocos2dJs cross platform game (in Android Platform) #20454

Open hatim-developer opened 4 years ago

hatim-developer commented 4 years ago

We are getting a crash whenever user changes device language & if game is in background. we are using cocos2dx-3.17.1 (Javascript) to build our games. It seems it is framework issue because to test this scenario we created new blank project & tried the same thing, it crashed.

Steps to Reproduce:

  1. Open the game
  2. Go to device settings & change the language.
  3. Open the background game (that is there in background )
  4. Click some buttons in game ( you should have some button that have some touch events ) --> game will crash once you click any button.

Stack trace from adb logcat: 01-31 12:10:57.814 6212 6451 W cr_ChildProcessConn: onServiceDisconnected (crash or killed by oom): pid=6454

01-31 12:10:57.998 6212 6212 E chromium: [ERROR:aw_browser_terminator.cc(125)] Renderer process (6454) crash detected (code -1).

01-31 12:10:58.026 6212 6212 E chromium: [ERROR:aw_browser_terminator.cc(90)] Render process (6454) kill (OOM or update) wasn't handed by all associated webviews, killing application.

01-31 12:10:58.183 3544 3544 I Zygote : Process 6212 exited due to signal (9)

01-31 12:10:58.201 3926 4301 I ActivityManager: Process com.x.x (pid 6212) has died: cch+1CAC (117,340)"

@slackmoehrle @pandamicro @rh101 & all contributors , please do share if you have any solution or any direction to look into this issue.

rampr commented 4 years ago

Tagging @minggo too

vyshnavsdeepak commented 4 years ago

This can be prevented if you manually restart the game.

Keeping a watch on onSaveInstanceState and restarting the app at onCreate worked. https://pastebin.com/2F3X8z53 https://github.com/JakeWharton/ProcessPhoenix

@rampr @hatim-developer @minggo