5

OS: Windows 7.

I have created a project in cordova, but when I try to build it with the command cordova build android, it returns an error which says:

ERROR building one of the platforms: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory. You may not have the required environment or OS to build this project Error: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory. at C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\lib\check_reqs.js:223:19 at _fulfilled (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:834:54) at self.promiseDispatch.done (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:863:30) at Promise.promise.promiseDispatch (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:796:13) at C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:857:14 at runSingle (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:137:13) at flush (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:125:13) at nextTickCallbackWith0Args (node.js:453:9) at process._tickCallback (node.js:382:13) at Function.Module.runMain (module.js:449:11) 

I've already set up a variable named ANDROID_HOME in the user environment variables with the path to my android sdk: E:\android\sdk. Still i'm getting this error.

2 Answers 2

4

Your path is not OK, you have to reference

E:\android\sdk\tools E:\android\sdk\platform-tools 

Into the Path variable

For checking if this is correctly installed, just enter android in your console, and check if there are no errors

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your response, but now it is asking me to update android target to android-23.. I think the issue is solved now, just need to update the target.
That it, just open your android developer tools and update it. Happy coding! (If the answer helped you, please vote it and/or mark it as correct, thanks!)
1

Had the same issue, fixed it by renaming a folder called "Fastboot" in my C:/ drive's root.

3 Comments

What? this answer is completely irrelevant
@ΔημήτρηςΦιλίππου Sorry, how is it not relevant if it's the only procedure that fixed the same error on my environment? (tried everything and this was the only way to fix it on my configuration)
My problem solved with this! But I had to rename a folder called "adb" instead of "Fastboot" like yours.. so, this answer is relevant for certain cases... thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.