From 61a792f323e2a42baa7692540aa57036f8426b56 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Tue, 28 Jan 2020 10:54:50 -0800 Subject: [PATCH] Make the error more instructive on missing android_jar_path So when $ANDROID_BUILD_TOP is missing, the error message print out the path of the missing file; instead of a type error. Bug: 148452817 Test: check result with missing ANDROID_BUILD_TOP Change-Id: I5f841f6626eb3843364f20e78b278d3244505396 --- tools/releasetools/apex_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py index 3d16d30ef4..113f78b191 100644 --- a/tools/releasetools/apex_utils.py +++ b/tools/releasetools/apex_utils.py @@ -124,8 +124,9 @@ class ApexApkSigner(object): android_jar_path = common.OPTIONS.android_jar_path if not android_jar_path: - android_jar_path = os.path.join(os.environ.get( - 'ANDROID_BUILD_TOP'), 'prebuilts/sdk/current/public/android.jar') + android_jar_path = os.path.join(os.environ.get('ANDROID_BUILD_TOP', ''), + 'prebuilts', 'sdk', 'current', 'public', + 'android.jar') logger.warning('android_jar_path not found in options, falling back to' ' use %s', android_jar_path)