Reputation: 37
Error at cmd when building ionic project with android
[Error: 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.]
ERROR building one of the platforms: Error: cmd: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 2
at ChildProcess.whenDone (C:\Users\Hasan\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess.handle.onexit (childprocess.js:1087:5)
so what is the problem what must I do to fix it ?? I have android sdk on my pc, and m working on windows 10, I have installed nodejs. Can anybody help me
Upvotes: 3
Views: 13045
Reputation: 925
Go to Advanced System Settings, then go to Environment Variables Then add new Variables with name "ANDROID_HOME" and the value will be you SDK path like
C:\Android\sdk
Make sure to restart visual studio before run again
it will fix
Upvotes: 2
Reputation: 6257
Go to Advanced System Settings, then go to Environment Variables and select PATH variable to edit. There you have to append path to platform tools and tools of sdk, for example like this
;C:\Development\android-sdk\platform-tools;C:\Development\android-sdk\tools
Now go to cmd and run android
, if that does not open android sdk manager, then it means path has not been set correctly or cmd is not recognizing enviroment variable updtes, in that case restart your computer and it will work.
Upvotes: 5