diff --git a/changes/1157.bugfix.rst b/changes/1157.bugfix.rst index 35609a32c..cb9c13db4 100644 --- a/changes/1157.bugfix.rst +++ b/changes/1157.bugfix.rst @@ -1 +1 @@ -Briefcase will now detect, if you try to launch an version on an android that is too old. +Briefcase will detect if you attempt to launch an Android app on a device whose OS doesn't meet minimum version requirements. diff --git a/src/briefcase/integrations/android_sdk.py b/src/briefcase/integrations/android_sdk.py index 0c6012df4..fdd87b44f 100644 --- a/src/briefcase/integrations/android_sdk.py +++ b/src/briefcase/integrations/android_sdk.py @@ -1336,10 +1336,11 @@ def run(self, *arguments: SubprocessArgT, quiet: bool = False) -> str: ], quiet=quiet, ) - # Manually raise error if "Failure [INSTALL_FAILED_OLDER_SDK]" occurs, - # because this failer results in return code 0 + # add returns status code 0 in the case of failure. The only tangible evidence + # of failure is the message "Failure [INSTALL_FAILED_OLDER_SDK]" in the, + # console output; so if that message exists in the output, raise an exception. if "Failure [INSTALL_FAILED_OLDER_SDK]" in output: - raise BriefcaseCommandError("Failed to install older SDK") + raise BriefcaseCommandError("Your device doesn't meet the minimum SDK requirements of this app.") return output except subprocess.CalledProcessError as e: if any(DEVICE_NOT_FOUND.match(line) for line in e.output.split("\n")): diff --git a/tests/integrations/android_sdk/ADB/test_run.py b/tests/integrations/android_sdk/ADB/test_run.py index 0a72a223d..a61669e10 100644 --- a/tests/integrations/android_sdk/ADB/test_run.py +++ b/tests/integrations/android_sdk/ADB/test_run.py @@ -111,5 +111,8 @@ def test_older_sdk_error(mock_tools, adb): "Failure [INSTALL_FAILED_OLDER_SDK]", ] ) - with pytest.raises(BriefcaseCommandError): + with pytest.raises( + BriefcaseCommandError, + r"Your device doesn't meet the minimum SDK requirements of this app.", + ): adb.run("example", "command")