I want to create Android apps using Phonegap. I have installed nodejs, phonegap, cordova, eclipse and everything. But while trying to add android platform i am getting this error. After a lot of searching some says add 'ant' path to system variables. I have done that. But may be i did wrong. Tried a lot of times. Not working. Here the error i am getting while trying to add android platform
C:\hello>cordova platform add android
Creating android project...
C:\Users\gijo\.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.js:126
throw e;
^
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
at C:\Users\gijo\.cordova\lib\android\cordova\3.5.1\bin\lib\check_reqs.js:47
:27
at exithandler (child_process.js:644:7)
at ChildProcess.errorhandler (child_process.js:660:5)
at ChildProcess.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:808:12)
Error: C:\Users\gijo\.cordova\lib\android\cordova\3.5.1\bin\create.bat: Command
failed with exit code 8
at ChildProcess.whenDone (C:\Users\gijo\AppData\Roaming\npm\node_modules\cor
dova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
C:\hello>
In order to develop with PhoneGap, and for the system (Windows in your case) to recognize all the directories and all the files you installed, you indeed need to add those libraries to "variables" inside the System Properties.
Make sure you have the right path. For example:
Variable name: JAVA_HOME
Variable value: C:\Program Files (x86)\Java\jdk1.6.0_39
Variable name: ANT_HOME
Variable value: C:\Program Files (x86)\WinAnt
I had the same problem but solved.The issue related with ant path.Set the path in system variables by this way.
goto Environmentvariables->system variables->select path variable click edit and add your ant path after a semicolon.
Related
I'm trying to get Phone-gap to work, I followed this tutorial: http://www.levibotelho.com/development/the-complete-guide-to-running-phonegap-on-ubuntu/. I am one Ubuntu 13.10. I have tried many different solutions found on stack-overflow and others, and non of them work.
The export I am using:
export ANDROID_HOME="/usr/local/android-sdk-linux/tools"
export ANDROID_PLATFORM_TOOLS="/usr/local/android-sdk-linux/platform-tools"
export PATH="$PATH:$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS"
The error I am getting is this:
Running command: /hdd/Fred/Documents/phonegap/helloworld/platforms/android/cordova/run --emulator
ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Error: /hdd/Fred/Documents/phonegap/helloworld/platforms/android/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
Please help.
#Rupesh is correct - set ANDROID_HOME to the sdk dir, not the tools dir.
So you don't have to do this each time you open a terminal, pop it into your .bashrc in your home dir:
export ANDROID_HOME="/usr/local/android-sdk-linux/"
(As the error you get implies, if ANDROID_HOME is set, you shouldn't need to modify your PATH, but I guess it can't do any harm)
If that still doesn't work, check that the sdk path is actually correct.
I have created a Cordova Application Project using the CLI tool and NetBeans IDE for Cordova Project. I have also mapped the following path variables.
ANDROID_HOME F:\AndroidProjects\adt-bundle-windows-x86-20131030\
ANT_HOME C:\apache-ant-1.9.4\
JAVA_HOME C:\Program Files\Java\jdk1.8.0_25\
PATH C:\Users\Administrator\AppData\Roaming\npm;F:\Android Projects\adt-bundle-windows-x86-20131030\sdk\platform-tools\;F:\AndroidProjects\adt-bundle-windows-x86-20131030\SDK\TOOLS\;C:\Program Files\Java\jdk1.8.0_25\bin;%JAVA_HOME%\bin;C:\Program Files (x86)\Git\;C:\Program Files (x86)\Git\bin;%ANT_HOME%/bin;
I am also able to run the Demo Cordova Application on AVD and Real device,using eclipse. But, while trying to build the project with additional changes the CLI is giving me with the following error message
[Error: ANDROID_HOME is set to a non-existant path: F:\Android
Projects\adt-bund le-windows-x86-20131030] Command finished with error
code 2: F:\CordovaProjects\CordovaAppOne\platforms\a
ndroid\cordova\build.bat Error:
F:\CordovaProjects\CordovaAppOne\platforms\android\cordova\build.bat:
Com mand failed with exit code 2
at ChildProcess.whenDone (C:\Users\Administrator\AppData\Roaming\npm\node_mo
dules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
What should I set in addition to the above to resolve the error. I am using Windows8-64Bit on administrator account. Only Android platform has been added to the application using the CLI.
Issue has been resolved. The issue was raised due to wrong pointing of ANDROID_HOME environment variable. It is required that the variable directly points to sdk folder itself instead of the Android Eclipse bundle.
I try the command >cordova platform add android
and here's what I get:
C:\Users\Daniel\Workspaces\cordova\hello>cordova platform add android
Creating android project...
C:\Users\Daniel\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_mo
dules\q\q.js:126
throw e;
^
Error: Failed to run "android". Make sure you have the latest Android SDK instal
led, and that the "android" command (inside the tools/ folder) is added to your
PATH.
at C:\Users\Daniel\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\
lib\check_reqs.js:43:27
at exithandler (child_process.js:644:7)
at ChildProcess.errorhandler (child_process.js:660:5)
at ChildProcess.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:808:12)
Error: C:\Users\Daniel\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\
create.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Daniel\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
As far as I can tell, my Path is set right.
ANDROID_HOME C:\Development\adt-bundle\sdk\
Path %ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;etc
Previously I had my path set explicitly with the same error (Path C:\Development\adt-bundle\sdk\platform-tools;etc). I've tried several different combinations to try to get it to work, but I always get the same error. My Android SDK is up do date. What am I missing?
So, it turns out that when I updated the Path, I erased the default values in there. For windows 7 it was
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
Then append to the end of that. Doing this gave me a new error:
Error: Please install Android target "android-19"
From here it was clear to me what to do, but if anyone else runs across this, here is a solution to the second error: Cordova 3.5.0 Install Error- Please Install Android Target 19
I'm trying to set a phonegap project but I cannot seem to be able to add platforms to it. When I try to add android I get the following error message:
Error: ERROR : executing command 'ant', make sure you have ant installed and add
ed to your path.
at C:\Users\spacitron\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:4
7:27
at exithandler (child_process.js:643:7)
at ChildProcess.errorhandler (child_process.js:659:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:805:12)
Error: C:\Users\spacitron\.cordova\lib\android\cordova\3.4.0\bin\create.bat: Command
failed with exit code 8
at ChildProcess.whenDone (C:\Users\spacitron\AppData\Roaming\npm\node_modules\co
rdova\src\superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Which doesn't make much sense to me because when I run "and -version" I get the following:
Apache Ant<TM> version 1.9.4 compiled on April 29 2014
So what could I possibly be missing here?
As you error says that it can't find your ant.
You need to add path in your environment variables
PATH
;%JAVA_HOME%\bin;%ANT_HOME%\bin;%ANDROID_SDK%;%ANDROID_ADB%;
(You can also add absolute paths in about command)
ANT_HOME
C:\Program Files\Java\ant\
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_25
ANDROID_SDK
C:\Android\sdk\tools
ANDROID_ADB
C:\Android\sdk\platform-tools
Run these four commands to check every thing is setup properly
adb
android
javac
ant
Creating project command
move to the phonegap android folder.Press Shift+Right Click and select "open Command window here"
create Path_to_Project Package_Name Project_Name
create C:\Users\YourUsername\Desktop com.talha.test HelloWorld
Check these links for more help.1,2.
I recently installed cordova (phonegap), and am having such a difficult time getting it running on Linux (Ubuntu 12.04)
Whenever I try to build my project, I get this error :
[Error: An error occurred while listing Android targets]
Error: /home/<my-name>/phone_project/workshop/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:126:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
I researched this problem and try these different fixes :
I set my PATH variable both to the tools and platform-tools in my adt-bundle.
I set my ANT_HOME variable and didn't forget to add the ANT_HOME/bin in my PATH :
I set my JAVA_HOME variable to java 1.7 jdk :
None of them worked for me.
Here is a copy of my ~/.bashrc file :
(...)
export PATH=~/phone_project/adt-bundle-linux-x86_64-20140321/sdk/tools/:~/phone_projet/adt-bundle-linux-x86_64-20140321/sdk/platform-tools/:/androicdd-sdks/platform-tools/:$PATH
export ANT_HOME=/usr/local/lib/node_modules/ant/
export PATH=$ANT_HOME/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/
Those are all the fixes I found, and I've been searching for a long time.
Any one knows what's up ?
A pizza for whoever finds the right fix :D