aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrendan Jackman <brendan.jackman@arm.com>2017-10-09 18:30:06 +0100
committerBrendan Jackman <brendan.jackman@arm.com>2017-10-09 18:31:32 +0100
commit99aca2543835d56001eec63ce60e6c7dc73a4570 (patch)
tree2adb0716c9a009bd56ba4cb87207fffb689d4338
parent7e073c1fce9304cdf7b60f507208f15a66939bc0 (diff)
downloaddevlib-99aca2543835d56001eec63ce60e6c7dc73a4570.tar.gz
ApkInfo: Improve error for bad .apk files
Provide a more specific error, including the output from aapt.
-rw-r--r--devlib/utils/android.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/devlib/utils/android.py b/devlib/utils/android.py
index ce1ab0b..0cdd2b0 100644
--- a/devlib/utils/android.py
+++ b/devlib/utils/android.py
@@ -135,7 +135,11 @@ class ApkInfo(object):
_check_env()
command = [aapt, 'dump', 'badging', apk_path]
logger.debug(' '.join(command))
- output = subprocess.check_output(command)
+ try:
+ output = subprocess.check_output(command, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as e:
+ raise HostError('Error parsing APK file {}. `aapt` says:\n{}'
+ .format(apk_path, e.output))
for line in output.split('\n'):
if line.startswith('application-label:'):
self.label = line.split(':')[1].strip().replace('\'', '')