Provide more informative error messages on android related environment / device related issues (#1261)

- If gradle is installed, but JAVA_HOME is not set properly, no detail message is given. Bubble up the error message as part of the description
- When deploying a newer API Level APK (30) to an API Level 29 device, a python callstack is given without any detail of the error. Now it will report the actual error that is from the adb call so the user can act upon it
This commit is contained in:
Steve Pham
2021-06-11 08:12:49 -07:00
committed by GitHub
parent 63a612efbc
commit f775ba7df8
2 changed files with 22 additions and 10 deletions
@@ -184,11 +184,15 @@ class AndroidDeployment(object):
call_arguments.extend(arg_list)
output = subprocess.check_output(call_arguments,
shell=True,
stderr=subprocess.DEVNULL).decode(common.DEFAULT_TEXT_READ_ENCODING,
common.ENCODING_ERROR_HANDLINGS)
return output
try:
output = subprocess.check_output(call_arguments,
shell=True,
stderr=subprocess.PIPE).decode(common.DEFAULT_TEXT_READ_ENCODING,
common.ENCODING_ERROR_HANDLINGS)
return output
except subprocess.CalledProcessError as err:
raise common.LmbrCmdError(err.stderr.decode(common.DEFAULT_TEXT_READ_ENCODING,
common.ENCODING_ERROR_HANDLINGS))
def adb_shell(self, command, device_id):
"""