Scons - Compile for Android on Windows

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hodor88

Hi there, having some trouble compiling the godot sourcecode for android on Windows OS. I am not using WSL.

Android SDK and NDK are installed. Environment Variables are set up correctly.
When i try to run scons command for android platform i get the error that android is not available as platform:

'PS E:\Repositories\godot\godot> scons platform=android target=release android_arch=arm64v8
scons: Reading SConscript files ...
Invalid target platform "android".
The following platforms were detected:

windows

Please run SCons again and select a valid platform: platform=<string>

Installed SDKs (API Level) are: 29, 26 and 24

Have no idea what is missing

:bust_in_silhouette: Reply From: lazypenguin

This occurs when scons cannot find the android sdk/ndk. The following environment variables need to be set:

ANDROID_HOME
ANDROID_NDK_HOME
ANDROID_NDK_ROOT

Example of paths on my windows machine with sdk/ndk install via android studio:

ANDROID_HOME=C:\Users\Ralph\AppData\Local\Android\Sdk
ANDROID_NDK_HOME=C:\Users\Ralph\AppData\Local\Android\Sdk\ndk\22.0.6917172
ANDROID_NDK_ROOT=C:\Users\Ralph\AppData\Local\Android\Sdk\ndk\22.0.6917172

Additionally, don’t forget to restart your terminal after setting these variables.