1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

ApkInfo: Improve error for bad .apk files

Provide a more specific error, including the output from aapt.
This commit is contained in:
Brendan Jackman 2017-10-09 18:30:06 +01:00
parent 7e073c1fce
commit 99aca25438

View File

@ -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('\'', '')