From 721c3a16b85f8af2cff8e2a7277465433520f36a Mon Sep 17 00:00:00 2001 From: The android_world Authors Date: Thu, 16 Jul 2026 13:13:58 -0700 Subject: [PATCH] APK installation failures will now raise an exception PiperOrigin-RevId: 949134375 --- android_world/env/adb_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android_world/env/adb_utils.py b/android_world/env/adb_utils.py index 4689b456..0cd354bf 100644 --- a/android_world/env/adb_utils.py +++ b/android_world/env/adb_utils.py @@ -1056,10 +1056,15 @@ def install_apk( Raises: ValueError: If apk location does not exist. + RuntimeError: If the installation failed. """ if not os.path.exists(apk_location): raise ValueError('APK does not exist.') - issue_generic_request(['install', apk_location], env, timeout_sec=30.0) + response = issue_generic_request( + ['install', apk_location], env, timeout_sec=30.0 + ) + if response.status != adb_pb2.AdbResponse.Status.OK: + raise RuntimeError(f'Failed to install APK {apk_location}: {response}') def check_airplane_mode(env: env_interface.AndroidEnvInterface) -> bool: