diff --git a/keydive/adb.py b/keydive/adb.py index a6915a8..fb0c4fc 100644 --- a/keydive/adb.py +++ b/keydive/adb.py @@ -141,8 +141,11 @@ class ADB: # Parse and store applications in the dictionary for line in sp.stdout.decode('utf-8').splitlines(): - path, package = line.strip().split(':', 1)[1].rsplit('=', 1) - applications[package] = path + try: + path, package = line.strip().split(':', 1)[1].rsplit('=', 1) + applications[package] = path + except Exception as e: + pass return applications @@ -160,6 +163,9 @@ class ADB: sp = shell([*self.prompt, 'dumpsys', 'package', package]) lines = sp.stdout.decode('utf-8').splitlines() + # Remove empty lines to ensure backwards compatibility + lines = [l.strip() for l in lines if l.strip()] + # Look for main activity in package information for i, line in enumerate(lines): if 'android.intent.action.MAIN' in line: