Overview
When a Titanium SDK build fails because the Android SDK cannot be located, the first step is to confirm how the build tools are receiving the SDK location.
Verify the ANDROID_SDK environment variable
Ensure that the ANDROID_SDK environment variable is set to the absolute path of the Android SDK root directory (the folder that contains platforms/, tools/, etc.). You can check its value in the terminal with:
echo $ANDROID_SDK # on macOS/Linux
echo %ANDROID_SDK% # on Windows
If the variable is empty or points to a non‑existent directory, the Titanium CLI will not be able to locate the SDK.
Inspect the build output for SDK‑related messages
Run the build command again and look for any lines that indicate the SDK could not be found. Typical wording (as described in the Titanium documentation) includes phrases such as "Unable to locate Android SDK" or references to missing android.jar. The presence of such messages strongly suggests a path configuration problem.
Pass the SDK path directly via the CLI (if supported)
Some Titanium CLI versions allow overriding the SDK location with a command‑line flag, often formatted as:
titanium build --android-sdk /path/to/android-sdk
Consult the specific version’s help output (titanium build --help) to confirm the exact flag name and syntax.
Next steps if the issue persists
- Confirm that the Android SDK installation is complete (platforms, build‑tools, and tools sub‑folders are present).
- Restart the terminal or IDE after changing environment variables so the new value is picked up.
- If you are using a CI system, ensure the variable is exported in the build agent’s environment before invoking the Titanium CLI.
- Refer to the official Titanium SDK documentation for the most accurate and version‑specific guidance on SDK configuration and diagnostic logging.