Unity "Android SDK / NDK not found" in CI build
A Unity Android build needs the Android SDK, NDK, and JDK to be present and pointed at by the editor. In CI a base editor image without the Android module, or unset paths, fails before Gradle runs.
What this error means
The Android build fails with "Unable to locate Android SDK", "Android NDK not found", or "Android SDK is missing" before any Gradle output appears.
Error building Player: Unable to locate Android SDK.
Android NDK not found. Please set the NDK path in the Editor preferences.Common causes
The editor image lacks the Android module
A Linux base editor image without the Android module ships no bundled SDK/NDK, so the Android target cannot build.
SDK/NDK/JDK paths are not set for batchmode
Even with tools installed, the editor needs ANDROID_SDK_ROOT, the NDK path, and a JDK pointed at correctly to locate them.
How to fix it
Use an Android editor image
Build Android with a GameCI image variant that bundles the Android module, SDK, and NDK.
- uses: game-ci/unity-builder@v4
with:
targetPlatform: Android
customImage: unityci/editor:ubuntu-2022.3.21f1-android-3Point the editor at the tools
Set the SDK, NDK, and JDK environment variables so the Android build can locate them.
env:
ANDROID_SDK_ROOT: /opt/android-sdk
ANDROID_NDK_HOME: /opt/android-ndkHow to prevent it
- Use an editor image that bundles the Android module.
- Set SDK/NDK/JDK paths explicitly for batchmode builds.
- Keep the NDK version aligned with the editor requirement.