Android原生关闭游戏再起启动Crash

  • Creator 版本:1.9.0

  • 目标平台:Android

  • 详细报错信息,包含调用堆栈:
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xe24
    Stack frame #00 pc 00c14f60 /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so: Routine v8::HandleScope::Initialize(v8::Isolate*) at libgcc2.c:?
    Stack frame #01 pc 00c14fb1 /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so: Routine v8::HandleScope::HandleScope(v8::Isolate*) at libgcc2.c:?
    Stack frame #02 pc 0078e1c8 /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so (_ZN2se15AutoHandleScopeC2Ev+36): Routine se::AutoHandleScope::AutoHandleScope() at /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/scripting/js-bindings/proj.android/…/jswrapper/v8/ScriptEngine.hpp:62 (discriminator 1)
    Stack frame #03 pc 00b1e5e4 /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so (ZN13ScriptingCore19releaseScriptObjectEPN7cocos2d3RefES2+268): Routine ScriptingCore::releaseScriptObject(cocos2d::Ref*, cocos2d::Ref*) at /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/scripting/js-bindings/proj.android/…/manual/ScriptingCore.cpp:108
    Stack frame #04 pc 014ca064 /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so (_ZN7cocos2d8Director5resetEv+124): Routine cocos2d::Director::reset() at /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/base/CCDirector.cpp:1012
    Stack frame #05 pc 014ca32c /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so (_ZN7cocos2d8Director13purgeDirectorEv+20): Routine cocos2d::Director::purgeDirector() at /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/base/CCDirector.cpp:1096
    Stack frame #06 pc 014cbbb4 /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so (_ZN7cocos2d8Director8mainLoopEv+48): Routine cocos2d::Director::mainLoop() at /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/base/CCDirector.cpp:1431
    Stack frame #07 pc 0078798b /data/app/org.cocos2d.polished_project-1/lib/arm/libcocos2djs.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender+18): Routine Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender at /Applications/CocosCreator.app/Contents/Resources/cocos2d-x/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp:18 (discriminator 1)
    Stack frame #08 pc 001a9a2d /data/app/org.cocos2d.polished_project-1/oat/arm/base.odex (offset 0x19d000)

  • 重现方式:
    使用polished_project工程,构建Android工程,增加一个MainActivity作为启动界面,在这个Activity中,添加按钮跳转至AppActivity,在游戏中监听返回按键。从MainActivity首次跳转至AppActivity正常,返回按键关闭AppActivity后再次启动APPActivity必现Crash。

  • 之前哪个版本是正常的 :

  • 手机型号 :

  • 手机浏览器 :

  • 编辑器操作系统 :

  • 编辑器之前是否有其它报错 :

  • 出现概率:必现

  • 额外线索:

求大大帮忙看看

多 activity 切换一直有很多问题,引擎在设计的时候没有考虑这种使用场景,相关讨论有很多,你了解一下

http://forum.cocos.com/t/cocos2dx-activity/1621

上面这个帖子有开发者提出临时解决方法

http://forum.cocos.com/t/android-activity-cocos2d-activity/44955

上面这个有大佬 @子龙山人 的回复

http://forum.cocos.com/t/cocos2dx-android-activity/14035

要调整 onPurse 和 onResume 的逻辑

https://discuss.cocos2d-x.org/t/it-is-tooooo-slow-swith-between-cocos2d-x-activity-and-android-activity/2991

有一些调整的尝试

1赞

有解决吗?我也遇到相同的问题了,但是我没有用多appActivity,也是偶现的,我修改了appActivity的启动页面主题:不知道有没有影响