Cordova cannot add Android failed with exit code ENOENT
Asked Answered
P

8

6

I am trying to create an Android project with Cordova, however i am getting an ENOENT error although i followed the tutorial step by step very carefully, this is getting me angry. First this is the screenshot of the error: enter image description here Here are information about my software and hardware/os:

Hardware and OS:

  • Intel(R) Core(TM) i5-3230M CPU @ 2.60 GHz 2.60GHz
  • 4 GB RAM
  • 64 bit operating system, x 64 based processor
  • Windows 8

Software: Here are some of the outputs of my command line for the related software.

  • $ npm -version
  • Output: 1.4.8
  • $ cordova -version
  • Output: 3.4.1-0.1.0
  • $ ant -version
  • Output: Apache Ant(TM) Version 1.9.3 compiled on December 23 2013
  • $ java -version

enter image description here

  • $ adb version
  • Output: Android Debug Bridge version 1.0.31

Here are some of my system variables:

  • ANDROID_HOME: C:\adt-bundle-windows-x86_64-20140321\sdk
  • ANT_HOME: C:\apache-ant-1.9.3
  • JAVA_HOME: C:\Program Files\Java\jdk1.8.0_05
  • CLASSPATH: %JAVA_HOME%\jre\lib
  • PATH: %JAVA_HOME%\bin;C:\app\barisa\product\11.2.0\dbhome_1\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;%ANT_HOME%\bin;C:\adt-bundle-windows-x86_64-20140321\sdk\platform-tools;C:\adt-bundle-windows-x86_64-20140321\sdk\tools;C:\Program Files\nodejs\

  • Note: I copied the tools.jar from jdk/lib to jre/lib after some research on the internet. Not working.

  • Note 2: I give the command "cd C:\Users\barisa.cordova\lib\android\cordova\3.4.0\bin" There is a check_reqs file in that folder. However if i type $ chek_reqs in the command line it says "check_reqs is not recognized as an internal or external command ...."

  • Note 3: I opened command propmt (cmd) by right click -> run as administrator What should i do?

Extra information with -d flag:

enter image description here

Update

I cleaned .cordova and reinstalled it and now, i am getting this error: enter image description here

My variables are defined as indicated above.

Prokofiev answered 2/5, 2014 at 7:27 Comment(4)
have you solved this issue?Plication
yes, i solved it. the order of paths in the environment variable were important. since i quitted my job, i cannot tell the order of variables. but advise you to check them twice.Nightwear
my order of paths is correct.But no idea still getting same error.Plication
Then please give us right order of path friendEverick
E
8

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.

Everick answered 2/7, 2015 at 6:48 Comment(1)
In my case, I had to restart the PC :) (I am on WIndows OS).Person
H
3

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

Hoskins answered 4/12, 2015 at 12:14 Comment(0)
J
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.

Jardena answered 22/3, 2016 at 15:49 Comment(0)
B
1

Try to follow these steps:

  1. run the command: npm uninstall cordova -g
  2. delete the folder: C:\Users\your-name\.cordova
  3. reinstall the cordova: npm install -g cordova
  4. now go to the project folder and try again: cordova platform add android
Braided answered 12/8, 2014 at 10:37 Comment(1)
After trying everything its the cordova update that worked for me : npm update -g cordovaUntruth
P
1

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.

Pulpiteer answered 17/9, 2015 at 17:6 Comment(0)
S
1

In my case problem was user variable TEMP. There were two folders.

Not working TEMP -path:

%USERPROFILE%\AppData\Local\Temp;C:\php

Working TEMP -path:

 %USERPROFILE%\AppData\Local\Temp

After this everything worked fine!

Shantay answered 12/2, 2016 at 9:26 Comment(0)
N
0

I had this exact same error days ago with cordova version 3.1.Go to directory path C:\Program Files\nodejs and then install your cordova.Sometimes cordova cannot connect to the right path of npm due to conflict.Then create your project and add platform android.Hope this solution works for you too.

Neediness answered 2/5, 2014 at 7:57 Comment(1)
hi.thanks for the suggesstion. i went to the c:\program files\nodejs directory and uninstalled the cordova with the command "$ npm uninstall cordova -g" then within the same directory i installed it with the command "$ npm install cordova -g". then i created a brand new project and i tried to add platform android. however i am getting the same error.Nightwear
I
0

I just run cmd with as Administrator and execute 'cordova platform add android' command and now work fine.

Intranuclear answered 13/9, 2017 at 8:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.