private void stopEmulator ( IDevice device ) { int devicePort = extractPortFromDevice ( device ) ; if ( devicePort == - 1 ) { getLog ( ) . info ( "Unable to retrieve port to stop emulator " + DeviceHelper . getDescriptiveName ( device ) ) ; } else { getLog ( ) . info ( "Stopping emulator " + DeviceHelper . getDescriptiveName ( device ) ) ; sendEmulatorCommand ( devicePort , "avd stop" ) ; boolean killed = sendEmulatorCommand ( devicePort , "kill" ) ; if ( ! killed ) { getLog ( ) . info ( "Emulator failed to stop " + DeviceHelper . getDescriptiveName ( device ) ) ; } else { getLog ( ) . info ( "Emulator stopped successfully " + DeviceHelper . getDescriptiveName ( device ) ) ; } } }
This method contains the code required to stop an emulator