Why not open the editor?
Because the build machine’s GPU is too poor, it won’t open…
Here is a way to edit the UE4 config file directly.
In BaseEngine.ini, just set the following variables:
[/Script/AndroidPlatformEditor.AndroidSDKSettings]
SDKAPILevel=latest
NDKAPILevel=android-21
SDKPath=(Path="D:/Android/SDK")
NDKPath=(Path="D:/Android/NDK")
JavaPath=(Path="D:/Android/OpenJDK")
Note in particular that the Key for the JDK path is JavaPath, not JDKPath as written in the official documentation. I am using UE4.27 here, and it tests out fine.