1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-05 18:30:50 +01:00

utils/apk_info: Handle apks that do not contain classes.dex

Some apks do not contain the file that we use to determine app methods
so return an empty list in this case.
This commit is contained in:
Marc Bonnici 2020-11-25 10:20:03 +00:00 committed by setrofim
parent bf4e242129
commit beb3b011bd

View File

@ -215,10 +215,14 @@ class ApkInfo(object):
@property
def methods(self):
if self._methods is None:
# Only try to extract once
self._methods = []
with tempfile.TemporaryDirectory() as tmp_dir:
with zipfile.ZipFile(self._apk_path, 'r') as z:
extracted = z.extract('classes.dex', tmp_dir)
try:
extracted = z.extract('classes.dex', tmp_dir)
except KeyError:
return []
dexdump = os.path.join(os.path.dirname(aapt), 'dexdump')
command = [dexdump, '-l', 'xml', extracted]
dump = self._run(command)