mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00: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:
parent
bf4e242129
commit
beb3b011bd
@ -215,10 +215,14 @@ class ApkInfo(object):
|
|||||||
@property
|
@property
|
||||||
def methods(self):
|
def methods(self):
|
||||||
if self._methods is None:
|
if self._methods is None:
|
||||||
|
# Only try to extract once
|
||||||
|
self._methods = []
|
||||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||||
with zipfile.ZipFile(self._apk_path, 'r') as z:
|
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')
|
dexdump = os.path.join(os.path.dirname(aapt), 'dexdump')
|
||||||
command = [dexdump, '-l', 'xml', extracted]
|
command = [dexdump, '-l', 'xml', extracted]
|
||||||
dump = self._run(command)
|
dump = self._run(command)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user