cordova platform add android error javac - android

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.

Related

Cannot use Bitnami Node.js for building Cordova App. Because npm not recognized

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.

android platform is not adding in Cordova project - java environment error

when adding android platform to my cordova project i am getting this error
Error: failed to run 'java -version', make sure your java environment is set up including jdk and jre
your JAVA_HOME variable is c:\program files\java\jdk1.7.0_45\bin
Error: Command failed: 'java' is not recognized as an internal or external command,
operable program or batch file.
while i have set JAVA and JAVA_HOME variable in systemVariable.
JAVA C:\Program Files\Java\jdk1.7.0_45\bin
JAVA_HOME C:\Program Files\Java\jdk1.7.0_45
and in Path i have set this
“;%JAVA_HOME%\bin”;%ANT_HOME%\bin;;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%JAVA%\bin;
You only have to set JAVA_HOME environment variable Not JAVA..
And in 'PATH' add %JAVA_HOME%\bin ..
Then test java -version command in cmd first if its working then try to run cordova build command.
see this doc for more detail..

Cordova cannot add Android failed with exit code ENOENT

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.

Android studio giving us following error

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...

Android SDK not working

The Android SDK doesn't open so i tried to open Android.bat to see the errors and I get this Error:
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
The system cannot find the file specified.
Error: Could not find or load main class com.android.sdkmanager.Main
Press any key to continue . . .
Here is my Environment Variables:
ANDROID_SWT: C:\adt-bundle-windows-x86\sdk\tools\lib\x86.
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_25. JDK_HOME:
C:\Program Files\Java\jdk1.7.0_25. PATH:(Sorted that it will be
Readable)
C:\Python33\; %SystemRoot%\system32; %SystemRoot%;
%SystemRoot%\System32\Wbem;
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; C:\Program
Files\Microsoft Network Monitor 3\;
C:\adt-bundle-windows-x86\sdk\platform-tools;
C:\adt-bundle-windows-x86\sdk\tools;C:\PHP; C:\Program
Files\TortoiseSVN\bin; C:\Program Files\Microsoft SQL
Server\110\Tools\Binn\; C:\Program Files\Microsoft Visual Studio
11.0\VC\bin; C:\Program Files\OpenVPN\bin.
I searched the whole web and i couldn't find any answer, i would like if you will help me to fix it.
Thanks!
Taken from the possibly duplicated thread:
The latest SDK has AVD Manager in the SDK Manager itself. Open SDK
Manager -> Tools -> Manage AVDs
Did you try installing the JDK outside Program Files? That is install it in a directory, which does not have any spaces in the path. For example install the JDK in the following directory and try again
c:\installs\java
Make Sdk update to repair the sdk bundle and try making some
avds
Your JAVA_HOME might be configured wrongly. Trying changing the path to C:\Program Files\Java\jdk1.7.0_25\jre\bin

Categories

Resources