Android studio showing error while compiling program. I have no Idea that is it a Android Studio Environment Issue or Windows Issue. I don't now why is Android Studio finding cmd in C:\windows except of C:\windows\system32.
Execution failed for task
':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files (x86)\Android\android-studio\sdk\build-tools\19.0.1\dx.bat --dex --output
C:\Users\Umar\AndroidStudioProjects\EchoDaily\app\build\dex\debug
C:\Users\Umar\AndroidStudioProjects\EchoDaily\app\build\classes\debug
C:\Users\Umar\AndroidStudioProjects\EchoDaily\app\build\dependency-cache\debug
C:\Users\Umar\AndroidStudioProjects\EchoDaily\app\build\pre-dexed\debug\classes-56833bce4b6617d8545062aa1572a07084939734.jar
C:\Users\Umar\AndroidStudioProjects\EchoDaily\app\build\pre-dexed\debug\support-v4-19.0.1-04dde37e48405b4442ed2e114457f34f6f27cab4.jar
Error Code:
1
Output:
'C:\windows\cmd.exe' is not recognized as an internal or external command,
operable program or batch file.
'C:\windows\cmd.exe' is not recognized as an internal or external command,
operable program or batch file.
'C:\windows\cmd.exe' is not recognized as an internal or external command,
operable program or batch file.
here is my eacho %PATH% output
C:\Program Files (x86)\PC Connectivity Solution\;
C:\Program Files\Dell\DW WLAN Card;;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\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)\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 (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;
C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files (x86)\Common Files\UleadSystems\MPEG;
C:\Program Files\Microsoft\Web Platform Installer\;
C:\Program Files (x86)\HMA! Pro VPN\bin
I diagnosed Issue and solved it. This was Windows CMD Sefault Path Issue... i changed it in registry and my problem solved.
I removed key default with value C:\windows\cmd.exe in registry at HKEY_CURRENT_USER\Software\Microsoft\Command Processor and Problem Resolved...
Related
I am trying to install Kivy on my Windows 7 PC for Android development using python.
I have followed the steps mentioned here.kivy installation on Windows
I am getting the following error for
python -m pip install kivy
The first error
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\OEM\Anaconda3\libs /LIBPATH:C:\Users\OEM\Anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPORT:PyInit_buffer build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.obj /OUT:build\lib.win-amd64-3.6\kivy\graphics\buffer.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.lib
buffer.obj : warning LNK4197: export 'PyInit_buffer' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.exp
Generating code
Finished generating code
cythoning C:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics/context.pyx to C:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.c
building 'kivy.graphics.context' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\OEM\Anaconda3\include -IC:\Users\OEM\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /TcC:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.c /Fobuild\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.obj
context.c
c:\users\oem\appdata\local\temp\pip-build-jmayz55y\kivy\kivy\graphics\gl_redirect.h(8): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Running setup.py clean for kivy
Failed to build kivy
Installing collected packages: kivy
Running setup.py install for kivy: started
Running setup.py install for kivy: finished with status 'error'
Complete output from command C:\Users\OEM\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\OEM\\AppData\\Local\\Temp\\pip-build-jmayz55y\\kivy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\OEM\AppData\Local\Temp\pip-wg_pau0w-record\install-record.txt --single-version-externally-managed --compile:
Using distutils
Detected Cython version 0.25.2
This version of Cython is untested with Kivy. While this version may
work perfectly fine, it is possible that you may experience issues. If
you do have issues, please downgrade to a supported version. It is
best to use the newest supported version, 0.23, but the minimum
supported version is 0.20.
If your platform provides a Cython package, check if you can downgrade
to a supported version. Otherwise, uninstall the platform package and
install Cython via pip:
pip install -I Cython==0.23
User distribution detected, avoid portable command.
Windows platform detected, force GLEW usage.
Using this graphics system: OpenGL
WARNING: A problem occured while running pkg-config --libs --cflags gstreamer-1.0 (code 1)
b"'pkg-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
WARNING: A problem occured while running pkg-config --libs --cflags sdl2 SDL2_ttf SDL2_image SDL2_mixer (code 1)
b"'pkg-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
The second error:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\OEM\Anaconda3\libs /LIBPATH:C:\Users\OEM\Anaconda3\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.10586.0\um\x64" /EXPORT:PyInit_buffer build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.obj /OUT:build\lib.win-amd64-3.6\kivy\graphics\buffer.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.lib
buffer.obj : warning LNK4197: export 'PyInit_buffer' specified multiple times; using first specification
Creating library build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\buffer.cp36-win_amd64.exp
Generating code
Finished generating code
skipping 'C:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.c' Cython extension (up-to-date)
building 'kivy.graphics.context' extension
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\OEM\Anaconda3\include -IC:\Users\OEM\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10586.0\winrt" /TcC:\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.c /Fobuild\temp.win-amd64-3.6\Release\Users\OEM\AppData\Local\Temp\pip-build-jmayz55y\kivy\kivy\graphics\context.obj
context.c
c:\users\oem\appdata\local\temp\pip-build-jmayz55y\kivy\kivy\graphics\gl_redirect.h(8): fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
What is wrong with the installation?
From your first error message, your cython version may be the culprit. According to the kivy docs:
This version of Kivy requires at least Cython version 0.23, and has been tested through 0.23. Later versions may work, but as they have not been tested there is no guarantee.
Before installing kivy, try installing the specific cython version 0.23.
pip install cython==0.23
And then repeat the installation of kivy.
Py35+ support was added only recently, therefore Kivy 1.9.1 version (that on pypi) won't work on py35+.
To make it work compile either from source:
pip install https://github.com/kivy/kivy/zipball/master
or use wheels that are exactly on the same documentation page.
I am downloaded Node.js and Apache Ant from Bitnami. And set Environmental Variables for the Android SDK, Java JDK, Apache ANT and for NODE.js.
I have checked the PATH by echo %PATH% command in CMD and it results as
C:\ProgramData\Oracle\Java\javapath;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;
C:\Program Files (x86)\Windows Live\Shared;
C:\Program Files(x86)\WinSCP\;
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;
C:\Program Files\Java\jdk1.8.0_74\bin;
C:\Bitnami\apache-ant-1.9.2-bin\apache-ant-1.9.2;
C:\Softwares\android-sdk_r24.0.2-windows\android-sdk-windows\tools;
C:\Softwares\android-sdk_r24.0.2-windows\android-sdk-windows\platform-tools;
C:\Bitnami\nodejs-0.12.2-0;
But it always showing like this,
C:>npm -v
'npm' is not recognized as an internal or external command,
operable program or batch file.
Please suggest for fixing this.
Thanks
Found it.
The path for npm and cordova are present in nodejs\node_modules folder. So refer all paths from use_nodejs file. Please follow the steps.
Open the Command Prompt from Windows. And type C:\>set. From this you can get all system Variables and paths.
Open the use_nodejs which is the windows batch file from C:\xxx\Bitnami\nodejs-0.12.2-0 and type C:\>set, from this you can get all system Variables and paths but which is looking different.
Compare the variables and paths from both command prompt and you can get ideas of paths.
Change the path in Windows Command Prompt like setx NODE_HOME "C:\Bitnami\nodejs-0.12.2-0\nodejs\node_modules" from the use_nodejs command promt paths. Like this change whatever paths you want to add.
I'm having a problem building my APK in MSVC 2015.
Could the problem have something to do with the build pipeline?
Any ideas?
2>------ Build started: Project: NativeApp1.Packaging, Configuration: Debug ARM ------
2> ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
2> ANT_HOME=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3\
2> JAVA_HOME=C:\Program Files\Java\jdk1.7.0\jre
2> NDK_ROOT=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\android-ndk-r10\
2> 9.0 was unexpected at this time.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\AndroidPackaging\Android.Common.targets(280,5): error MSB3073: The command ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\Apps\apache-ant-1.9.3\\bin\ant.bat" debug -Dout.final.file="G:\Projects\Android\NativeApp1\ARM\Debug\NativeApp1.Packaging.apk"" exited with code 255.
first the JAVA_HOME is wrong, you should put SDK path not JRE path
JAVA_HOME C:\Program Files (x86)\Java\jdk1.7.0_03
JRE_HOME C:\Program Files (x86)\Java\jre7
this link should help you:
https://msdn.microsoft.com/en-us/library/dn872463%28v=vs.140%29.aspx?f=255&MSPPError=-2147217396
Sorry for my bad english.
I ran
cordova platform add android
and the error I got
Running command: "c:\Program Files\nodejs\node.exe" "d:\Users\Andy\Project
s\ionic-tut\hooks\before_platform_add\init_directories.js" "d:/Users/Andy/
Projects/ionic-tut"
Creating android project...
D:\Users\Andy\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\nod
e_modules\q\q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must
fulfill at least one of these conditions.
I ran this from git bash
on running it from cmd it throws a different error
Error: Please install Android target "android-19".
I ran a echo %PATH% to verify:
C:\ProgramData\Oracle\Java\javapath;
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLSClient\;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;
C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;
C:\Program Files\Intel\WiFi\bin\;
C:\Program Files\Common Files\Intel\WirelessCommon\;
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:\HashiCorp\Vagrant\bin;
C:\Program Files\nodejs\;
D:\Users\Andy\AppData\Roaming\npm;C:/Program Files/nodejs/node.exe;
C:\Program FIles\Java\jdk1.8.0_31\bin;
C:\Program Files (x86)\Android\android-sdk\tools;C:\Program Files (x86)\Android\android-sdk\platform_tools
I feel like I am messing up the enviroment variables somewhere but I have checked it multiple times and it seems to be right.
What am I missing?
Windows 8.1
You will need to run the command android from CMD to open the android SDK manager.
From there make sure that the Android 4.4.2(19) package is installed. Let me know if this fixes your issue.
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:
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
$ 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:
Update
I cleaned .cordova and reinstalled it and now, i am getting this error:
My variables are defined as indicated above.
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.
In my case I just needed to add "C:\Windows\System32" to my windows path.
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.
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.
Try to follow these steps:
run the command: npm uninstall cordova -g
delete the folder: C:\Users\your-name\.cordova
reinstall the cordova: npm install -g cordova
now go to the project folder and try again: cordova platform add android
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!
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.
I just run cmd with as Administrator and execute 'cordova platform add android' command and now work fine.