UBT fails with "ERROR: GetBuildPlatform: No BuildPlatform found for Android"

After re-installing NVidia CodeWorks for Android from the Extras folder in an attempt to solve an unrelated build issue, when attempting to build for Android, failure occurs almost immediately with the message, ERROR: GetBuildPlatform: No BuildPlatform found for Android.

Running UBT directly from the command line results in the additional message UnrealBuildTool.AndroidPlatformSDK has no valid SDK

What are the possible causes for this message?

At the time of writing, UBT looks for SDK, NDK, ANT, and Java locations first in the .ini Config file hierarchy, via these keys:

[/Script/AndroidPlatformEditor.AndroidSDKSettings]
SDKPath=(Path="...")
NDKPath=(Path="...")
ANTPath=(Path="...")
JavaPath=(Path="...")

For each path that resolves to null in the above method, the standard environment variable is used ( ANDROID_HOME, NDKROOT, ANT_HOME, and JAVA_HOME).

In my case, I had previously installed CodeWorks from NVidia’s website (due to the included installer failing for an inexplicable reason), then filled in paths within the Editor Settings window. The paths in the Editor Settings window were persisted in %LOCALAPPDATA%\Unreal Engine\Engine\Config\UserEngine.ini. When I re-installed CodeWorks, I used the included installer, which succeeded this time around, but contained a different NDK version than the previous installer that I had used. As a result, the actual NDK folder, and the previously set NDKPath, were different. When UBT tested for the existence of the NDK location specified in that ini file, because the ini files take precedence over the environment variables that were set (properly) by the CodeWorks installer, UBT failed for inability to locate NDK.

By correcting the path defined in that ini file, I was able to restore my ability to build for Android.