apache/cordova-android · error · CordovaError
Requirements check failed for Android SDK! Android SDK was n
Error message
Requirements check failed for Android SDK! Android SDK was not detected.
What it means
Summary error from check_reqs.run(): it resolves Promise.all([check_java(), check_android()]) and throws when values[1] (check_android's result) is falsy, meaning the SDK detection chain produced no usable Android SDK. `cordova requirements android` surfaces exactly this line when the SDK row fails.
Source
Thrown at lib/check_reqs.js:278
return android_sdk.list_targets().then(function (targets) {
if (targets.indexOf(desired_api_level) >= 0) {
return targets;
}
throw new CordovaError(`Please install the Android SDK Platform "platforms;${desired_api_level}"`);
});
};
// Returns a promise.
module.exports.run = function () {
console.log('Checking Java JDK and Android SDK versions');
console.log('ANDROID_HOME=' + process.env.ANDROID_HOME + ' (recommended setting)');
console.log('ANDROID_SDK_ROOT=' + process.env.ANDROID_SDK_ROOT + ' (DEPRECATED)');
return Promise.all([this.check_java(), this.check_android()]).then(function (values) {
console.log('Using Android SDK: ' + (process.env.ANDROID_HOME || process.env.ANDROID_SDK_ROOT));
if (!values[1]) {
throw new CordovaError('Requirements check failed for Android SDK! Android SDK was not detected.');
}
});
};
/**
* Object thar represents one of requirements for current platform.
* @param {String} id The unique identifier for this requirements.
* @param {String} name The name of requirements. Human-readable field.
* @param {String} version The version of requirement installed. In some cases could be an array of strings
* (for example, check_android_target returns an array of android targets installed)
* @param {Boolean} installed Indicates whether the requirement is installed or not
*/
const Requirement = function (id, name, version, installed) {
this.id = id;
this.name = name;
this.installed = installed || false;
this.metadata = {
versionView on GitHub (pinned to 7c1e190064)
Solutions
- Re-run `cordova requirements android` and read the earlier ANDROID_HOME-specific error it prints - fix that one (set ANDROID_HOME, fix its path, install cmdline-tools).
- Install the SDK and export ANDROID_HOME/ANDROID_SDK_ROOT plus PATH entries for platform-tools and cmdline-tools.
- Confirm the fix with `cordova requirements android` until all rows pass.
Example fix
# before $ cordova requirements android Requirements check failed for Android SDK! Android SDK was not detected. # after export ANDROID_HOME="$HOME/Android/Sdk" export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin:$PATH" $ cordova requirements android
Defensive patterns
Strategy: validation
Validate before calling
const [javaOk, androidOk] = await Promise.all([check_reqs.check_java(), check_reqs.check_android()]);
if (!androidOk) {
throw new Error('Android SDK not detected - set ANDROID_HOME and rerun `cordova requirements android`');
} Try / catch
try {
await check_reqs.run();
} catch (e) {
if (/Android SDK was not detected/.test(e.message)) {
// re-run check_android alone to surface the specific ANDROID_HOME error, then guide setup
}
throw e;
} Prevention
- Treat `cordova requirements android` as a required gate in CI before build jobs.
- Fix root cause (ANDROID_HOME / SDK presence) rather than skipping the requirements step.
When it happens
Trigger: `cordova requirements android` (or any consumer of check_reqs.run) when check_android resolves falsy - which is always downstream of one of the detection failures in the same file (unset ANDROID_HOME with no inferable tools, non-existent ANDROID_HOME path, etc.).
Common situations: CI container without Android env vars; a machine where ANDROID_HOME was typo'd; the final state after any of the check_android branches failed to establish a valid SDK root.
Related errors
- Failed to find 'ANDROID_HOME' environment variable. Try sett
- Failed to find 'ANDROID_HOME' environment variable. Try sett
- 'ANDROID_HOME' environment variable is set to non-existent p
- Please install the Android SDK Platform "platforms;${desired
- Failed to find 'ANDROID_HOME' environment variable. Try sett
AI-assisted analysis of apache/cordova-android@7c1e190064 (2026-08-22).
Data as JSON: /api/errors/d6c81773ef0bcdc6.
Report an issue: GitHub.