最近在项目中添加android的游戏退出逻辑,第一时间就想到了Unity的Application.quit()方法来实现,然而,就是这个在普通不过的功能,在有些android设备上却会出现crash。Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000001c
这个就是crash的信息,看到cause的原因,第一时间并没有考虑到时quit方法导致的,而是怀疑游戏中的service和游戏中的内存等没有处理好导致的,然后经过一系列的逻辑操作,发现并没有解决实际的问题,最终又回到了问题的起始地方。
仔细的查看log信息,发现游戏在这个机器上每次退出之后,日志里面都会有以下信息。
ActivityManager: Activity pause timeout for ActivityRecord
Unity: Timeout while trying to pause the Unity Engine.
ActivityManager: Activity destroy timeout for ActivityRecord
Unity: Timeout while trying detaching primary window.
ActivityManager: Launch timeout has expired, giving up wake lock!
ActivityManager: Activity pause timeout for ActivityRecord
Unity: Timeout while trying to pa