在统一的2017.4.30f1和2019.1.9f1中,我在将脚本后端设置为IL2CPP时尝试使用Unity的Application.Quit()方法,因此游戏正常关闭,但由于“不幸的游戏名称已停止”而出现强制关闭消息对话框。
注意:将脚本后端设置为mono时,一切正常,并且仅在低于5个版本的android中会出现此问题(当设置为IL2CPP时)。
我试图改变的事情
尝试通过将System.Diagnostics.Process.GetCurrentProcess()。Kill()替换为Application.Quit()[这还会产生其他错误]
public void QuitGame() {
Application.Quit();}
E / AndroidRuntime:致命例外:UnityMain java.lang.Error:致命异常[UnityMain] Unity版本:2017.4.30f1 设备型号:华为H30-U10 设备指纹:Huawei / H30-U10 / hwH30-U10:4.2.2 / HuaweiH30-U10 / C900B115:user / ota-rel-keys,release-keys
Caused by: java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 5e0404f0
Build fingerprint: 'Huawei/H30-U10/hwH30-U10:4.2.2/HuaweiH30-U10/C900B115:user/ota-rel-keys,release-keys'
Revision: '0'
pid: 17353, tid: 17367, name: UnityMain >>> com.company.gamename <<<
r0 00000000 r1 0077d304 r2 00004000 r3 dead10cc
r4 5e0404f0 r5 570b8b50 r6 00000000 r7 5e15def8
r8 5e25dc48 r9 5e15def0 sl 5e15deec fp 5e0404f0
ip 00004000 sp 5e25dc08 lr 5d81f970 pc 5d8244a8 cpsr 5e25d918
at libunity.0009f4a8(Native Method)
at libunity.0009a96c(Native Method)
at libdvm.dvmPlatformInvoke(dvmPlatformInvoke:112)
at libdvm.dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)(dvmCallJNIMethod:568)
at libdvm.00027460(Native Method)
at libdvm.dvmInterpret(Thread*, Method const*, JValue*)(dvmInterpret:180)
at libdvm.dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)(dvmCallMethodV:400)
at libdvm.dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)(dvmCallMethod:36)
at libdvm.00070404(Native Method)
at libc.__thread_entry(__thread_entry:72)