PrintStream logger, AndroidSdk androidSdk, String deviceIdentifier, String packageId)
throws IOException, InterruptedException {
AndroidEmulator.log(logger, Messages.UNINSTALLING_APK(packageId));
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
ForkOutputStream forkStream = new ForkOutputStream(logger, stdout);
String adbArgs = String.format("%s uninstall %s", deviceIdentifier, packageId);
Utils.runAndroidTool(launcher, build.getEnvironment(TaskListener.NULL),
forkStream, logger, androidSdk, Tool.ADB, adbArgs, null);
// The package manager simply returns "Success" or "Failure" on stdout