We are creating an SDK that is used in Cocos2d-x games (on Android/iOS).
As part of development, we have setup a test framework for running various tests on a real device (Android only at the moment).
One specific test needs to kill the app and launch it again.
It seems that Cocos2d-x does not provide any API for exiting (or killing) the running app.
Some online resources suggested that people have used the call to exit(0)
.
Is there any way to exit the game from Cocos2d-x ?
Calling exit(0)
seems to crash:
#00 pc 0001e824 /system/lib/libc.so
#01 pc 0001c76c /system/lib/libc.so (abort+4)
#02 pc 000122ed /system/lib/libc.so
#03 pc 00010f9d /system/lib/libc.so (dlfree+1184)
#04 pc 0000dabf /system/lib/libc.so (free+10)
#05 pc 000cbf59 /data/app-lib/com.test.cocos2dx_testapp-1/libhellocpp.so (cocos2d::BitmapDC::~BitmapDC()+10)
#06 pc 00024639 /system/lib/libc.so (__cxa_finalize+156)
#07 pc 000248f1 /system/lib/libc.so (exit+6)