From acb9dd61e7a413c204b5649564b3ddea940e4aef Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Mon, 26 Sep 2016 16:47:06 +0100 Subject: [PATCH] ApkWorkload: Fixed replacing apps on a device Previously if trying to downgrade an app using the `-r` option of `adb install` the `INSTALL_FAILED_VERSION_DOWNGRADE` error would occur. The app is now uninstalled first to prevent this. --- wlauto/common/android/workload.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wlauto/common/android/workload.py b/wlauto/common/android/workload.py index 8af9d1b5..8f077c2c 100644 --- a/wlauto/common/android/workload.py +++ b/wlauto/common/android/workload.py @@ -368,7 +368,9 @@ class ApkWorkload(Workload): def install_apk(self, context, replace=False): success = False - output = self.device.install(self.apk_file, self.install_timeout, replace=replace) + if replace: + self.device.uninstall(self.package) + output = self.device.install(self.apk_file, self.install_timeout) if 'Failure' in output: if 'ALREADY_EXISTS' in output: self.logger.warn('Using already installed APK (did not unistall properly?)')