Firstly try to stop emulator via adb then via kill process
This commit is contained in:
+18
-7
@@ -112,10 +112,15 @@ public class Emulator {
|
|||||||
OutputUtils.checkResult(RunUtils.execute(new RunUtils.RunSettings(getCreateCommand(), "no", true, null, false)));
|
OutputUtils.checkResult(RunUtils.execute(new RunUtils.RunSettings(getCreateCommand(), "no", true, null, false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startServer() {
|
private GeneralCommandLine createAdbCommand() {
|
||||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
||||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
||||||
|
return commandLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startServer() {
|
||||||
|
GeneralCommandLine commandLine = createAdbCommand();
|
||||||
commandLine.addParameter("start-server");
|
commandLine.addParameter("start-server");
|
||||||
System.out.println("Start adb server...");
|
System.out.println("Start adb server...");
|
||||||
OutputUtils.checkResult(RunUtils.execute(commandLine));
|
OutputUtils.checkResult(RunUtils.execute(commandLine));
|
||||||
@@ -129,9 +134,7 @@ public class Emulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void printLog() {
|
public void printLog() {
|
||||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
GeneralCommandLine commandLine = createAdbCommand();
|
||||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
|
||||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
|
||||||
commandLine.addParameter("logcat");
|
commandLine.addParameter("logcat");
|
||||||
commandLine.addParameter("-v");
|
commandLine.addParameter("-v");
|
||||||
commandLine.addParameter("time");
|
commandLine.addParameter("time");
|
||||||
@@ -146,9 +149,19 @@ public class Emulator {
|
|||||||
|
|
||||||
public void stopEmulator() {
|
public void stopEmulator() {
|
||||||
System.out.println("Stopping emulator...");
|
System.out.println("Stopping emulator...");
|
||||||
|
|
||||||
|
GeneralCommandLine command = createAdbCommand();
|
||||||
|
command.addParameter("-s");
|
||||||
|
command.addParameter("emulator-5554");
|
||||||
|
command.addParameter("emu");
|
||||||
|
command.addParameter("kill");
|
||||||
|
RunUtils.execute(command);
|
||||||
|
|
||||||
if (SystemInfo.isWindows) {
|
if (SystemInfo.isWindows) {
|
||||||
|
//TODO check that command above works on windows and remove this
|
||||||
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
|
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
|
||||||
}
|
}
|
||||||
|
|
||||||
finishProcess("emulator64-" + platform);
|
finishProcess("emulator64-" + platform);
|
||||||
finishProcess("emulator-" + platform);
|
finishProcess("emulator-" + platform);
|
||||||
}
|
}
|
||||||
@@ -198,9 +211,7 @@ public class Emulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void stopRedundantEmulators(PathManager pathManager) {
|
private void stopRedundantEmulators(PathManager pathManager) {
|
||||||
GeneralCommandLine commandLineForListOfDevices = new GeneralCommandLine();
|
GeneralCommandLine commandLineForListOfDevices = createAdbCommand();
|
||||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
|
||||||
commandLineForListOfDevices.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
|
||||||
commandLineForListOfDevices.addParameter("devices");
|
commandLineForListOfDevices.addParameter("devices");
|
||||||
RunResult runResult = RunUtils.execute(commandLineForListOfDevices);
|
RunResult runResult = RunUtils.execute(commandLineForListOfDevices);
|
||||||
OutputUtils.checkResult(runResult);
|
OutputUtils.checkResult(runResult);
|
||||||
|
|||||||
Reference in New Issue
Block a user