title: How to kill Cocos2d-x test app
body: <p>We are creating an SDK that is used in Cocos2d-x games (on Android/iOS).</p>
  
  <p>As part of development, we have setup a test framework for running various tests on a real device (Android only at the moment).</p>
  
  <p>One specific test needs to kill the app and launch it again.</p>
  
  <p>It seems that Cocos2d-x does not provide any API for exiting (or killing) the running app.</p>
  
  <p>Some online resources suggested that people have used the call to <code>exit(0)</code>.</p>
  
  <p>Is there any way to exit the game from Cocos2d-x ? </p>
  
  <p>Calling <code>exit(0)</code> seems to crash:</p>
  
  <pre><code>#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)
  </code></pre>