1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-07 21:50:49 +00:00

Merge pull request #188 from bjackman/apkinfo-better-error

ApkInfo: Improve error for bad .apk files
This commit is contained in:
setrofim 2017-10-10 08:35:55 +01:00 committed by GitHub
commit b0457f7ed7

View File

@ -135,7 +135,11 @@ class ApkInfo(object):
_check_env() _check_env()
command = [aapt, 'dump', 'badging', apk_path] command = [aapt, 'dump', 'badging', apk_path]
logger.debug(' '.join(command)) 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'): for line in output.split('\n'):
if line.startswith('application-label:'): if line.startswith('application-label:'):
self.label = line.split(':')[1].strip().replace('\'', '') self.label = line.split(':')[1].strip().replace('\'', '')