Cordova cannot add Android failed with exit code ENOENT

Solution 1:

If you are sure of yours paths try to type android in cmd if it says: 'xcopy' was not recognized.

then add to your path:

%SystemRoot%\system32; %SystemRoot%; %SystemRoot%\System32\Wbem;

In certain cases, don't forget to reboot the PC.

Solution 2:

In my case I just needed to add "C:\Windows\System32" to my windows path.

Solution 3:

I had a similar issue when trying ionic platform add android.

result; partial build with ENOENT error titled "cordova-plugin-console" on the same child process as mentioned above superspawn.js

After trying reinstalling etc.. without resolution I changed my path variables around. ANDROID_HOME was placed in user variables --

C:\Users\XXXXXX\AppData\Local\Android\android-sdk

PATH was updated in the system variables to remove previous entries for SDK and added at the end; %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Windows\System32;C:\Users\XXXXXX\Node\;C:\Users\XXXXX\AppData\Local\Android\android-sdk\tools;C:\Users\XXXXXX\AppData\Local\Android\android-sdk\platform-tools;

Restart pc, tested with new app ionic start <new folder> tabs cd to the folder created, test it runs with ionic serve --lab exit with q then try to add the platform. ionic platform add android

now it works..

Please note********* now when i run 'android' in the CMD from my user dir... C:\Users\XXXXX>android

i do not see the xcopy not found displayed to my screen. android SDK manager always loaded before and still now after i changed my paths.

Hope this helps p.s I run these cmds from my user acc which is not the admin acc as i never log in as or use my pc as an administrator.

Solution 4:

Make sure that if you created PATH as a system variable, you should run Command Prompt as administrator.

I created PATH as a user variable, and would get the same error when tryin to run as administrator.