From 4d397ab4658c66742e8868b17f966a929ff02c6e Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Wed, 28 Jun 2017 15:36:26 +0100 Subject: [PATCH] AndroidWorkload: Uninstall uiauto apks before reinstalling Due to the fact that uiauto apk files built on different machines will be signed with different keys, adb will fail to overwrite a previous version even when set to replace. This commit now will uninstall the previous uiauto apk file if present before attempting to install the new version. --- wa/framework/workload.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wa/framework/workload.py b/wa/framework/workload.py index 3a24f657..34a06578 100644 --- a/wa/framework/workload.py +++ b/wa/framework/workload.py @@ -293,7 +293,9 @@ class UiAutomatorGUI(object): instrumentation_string) def deploy(self): - self.target.install_apk(self.uiauto_file, replace=True) + if self.target.package_is_installed(self.uiauto_package): + self.target.uninstall_package(self.uiauto_package) + self.target.install_apk(self.uiauto_file) def set(self, name, value): self.uiauto_params[name] = value