I am trying to create a phonegap app, but each time I try to add a platform I get this error:
Creating a new cordova project with name "HelloWorld" and id "com.mc2now.hello" at location "/Users/tony/Desktop/eclipse/eclipse"
imac-6:eclipse tony$ cd eclipse
imac-6:eclipse tony$ cordova platform add android
Creating android project...
/Users/tony/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:126
throw e;
^
Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.
at /Users/tony/.cordova/lib/android/cordova/3.4.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/tony/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:808:24)
at /Users/tony/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/tony/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/tony/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:752:41)
at /Users/tony/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:574:44
at flush (/Users/tony/.cordova/lib/android/cordova/3.4.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /Users/tony/.cordova/lib/android/cordova/3.4.0/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/src/superspawn.js:112: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)
so, my question is how to add android to my path? I have tried this:
imac-6:eclipse tony$ export PATH=${PATH}:adt-bundle/sdk/platform-tools:/adt-bundle/sdk/tools
can someone please explain what I am doing wrong? Any help is much appreciated!
I had the same problem and it appeared to be permission problems in the installed adt-bundle.
the following fixed it for me:
$ sudo chown -R $(whoami) /Development/adt-bundle
Try going to your user directory cd ~/ and edit .bash_profile then add export PATH=${PATH}:adt-bundle/sdk/platform-tools:/adt-bundle/sdk/tools to that file.
Save, close the terminal and start it up again.
I had the same error on my linux box.
I fixed putting android sdk "tools" subdir in my system PATH env variable.
For example:
export PATH="/opt/android/adt-bundle-linux-x86_64-20140321/sdk/tools:$PATH"
You should also include "platform-tools" subdir.
Related
I'm using Ubuntu 14.04. I'm following the steps given in http://chrislarson.me/blog/how-use-cordova-ubuntu-build-android-apps.html
to build my first app for Android on Ubuntu.
But when I run this: cordova platform add android, I get the following message on the terminal:
Error: EACCES, open
'/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/.npmignore'
If i try running sudo cordova platform add android, I get
Creating android project...
/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_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.
at /home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/lib/check_reqs.js:159:19
at _fulfilled (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:760:13)
at /home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:821:14
at flush (/home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:442:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:929:3
Error: /home/a/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create: Command failed with exit code 8
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:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
try deleting the contents of
.cordova/lib/npm_cache/cordova-android/
and then try again.
cordova / npm cache cordova-android files deleting these will ensure a clean install.
first check your android path by echo $ANDROID_HOME
then if it is showing path then you have set ANDROID_HOME path correctly and
if not then do this
1) sudo gedit ~/.bashrc
2) then paste following path at the last of file save it and close.
export ANDROID_HOME=your_sdk_path/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
your first error is permission issue and second because ANDROID_HOME path not set correctly
I am on Windows 8 and following through how to install and use Cordova with Ionic Framework on Windows 8.1. I followed through the video here: http://learn.ionicframework.com/videos/windows-android/. I am stuck at 5:58 of the video where the SDK Manager is suppose to come up when I type 'android' in the command line, but it says it's unrecognizable command. I made sure my file directories are exact. What else am I missing? How do I fix this problem?
PATH
C:\Users\Jaime\AppData\Roaming\npm; C:\Program Files\Java\jdk1.8.0_25\bin; C:\Development\AndroidSDK\sdk\platform-tools; C:\Development\AndroidSDK\sdk\tools; C:\Development\ApacheAnt\bin; C:\Program Files\nodejs
Thanks!
Problem with Android command:
C:\Users\Jaime\myapp>ionic platform add android
npm http GET https://registry.npmjs.org/cordova-android/3.6.4
npm http 200 https://registry.npmjs.org/cordova-android/3.6.4
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.4.
tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.4.
tgz
Creating android project...
C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\node_mod
ules\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.
at C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\l
ib\check_reqs.js:159:19
at _fulfilled (C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\p
ackage\bin\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\Jaime\.cordova\lib\npm_cache\cordova-
android\3.6.4\package\bin\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\Jaime\.cordova\lib\npm_cache\co
rdova-android\3.6.4\package\bin\node_modules\q\q.js:760:13)
at C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\n
ode_modules\q\q.js:821:14
at flush (C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\packag
e\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:902:3
Error: C:\Users\Jaime\.cordova\lib\npm_cache\cordova-android\3.6.4\package\bin\c
reate.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Jaime\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\src\cordova\superspawn.js:135: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)
Update:
Here's what I have so far:
USER variables:
name: PATH
variable:
C:\Users\Jaime\AppData\Roaming\npm; C:\Program
Files\Java\jdk1.8.0_25\bin;
C:\Development\AndroidSDK\sdk\platform-tools;
C:\Development\AndroidSDK\sdk\tools;
C:\Development\AndroidSDK\sdk\build-tools; C:\Development\ApacheAnt\bin;
C:\Program Files\nodejs;
%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
SYSTEM variables:
name: ANDROID
variable: C:\Development\AndroidSDK\sdk
name: ANT
variable: C:\Development\ApacheAnt
name: JAVA
variable: C:\Program Files\Java\jdk1.8.0_25
Phonegap and cordova installation procedures
what are the need for installiation?
1)node js
download:http://nodejs.org/download/
We have node-v0.10.29-x64.msi (64 bit) installation. After install, open command prompt & type "node -v" , then "npm -v", these 2 commands should work without any error in command prompt.
Open command prompt - (Click windows and R keynd then enter the cmd)
2)phonegap
http://phonegap.com/install/
Install phonegap on cmd: enter npm install -g phonegap on cmd
After installation, files will be placed in C:\Users\Hari\AppData\Roaming\npm folder. You can check the installation by typing the command "phonegap -v" in command prompt.
3)java jdk
http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=otnjp
We have jdk-8u5-windows-x64.exe file.
You may need to add path variables in My computer-->Right click-->Properties-->Advanced system settigs-->Environment variables
After install, check "java -version" in command prompt. "where java" will help you to identify the installation path of the java.
4)ant
download:http://ant.apache.org/
We already have apache-ant-1.9.4-bin.zip portable edition of Ant, We need not to install, just need to extract the zip file & place it in some secure place.
You may need to add path variables in My computer-->Right click-->Properties-->Advanced system settigs-->Environment variables
Environment variables name:Ant_Home
Ex: C:\Program Files\apache-ant-1.9.4
5)android sdk
download:http://developer.android.com/sdk/index.html
We have adt-bundle-windows-x86_64-20140624/SDK Manager.exe file.
6)ionic
cmd-->npm install -g ionic
7)cordova
cmd-->npm install -g cordova
PATH SETTING
My computer-->Right click-->Properties-->Advanced system settigs-->Environment variables
Edit the Path and give the like this
C:\Users\prabhu\AppData\Roaming\npm;C:\Program Files\apache-ant-1.9.4\bin;C:\phonegap_project\adt-bundle-windows-x86_64-20131030\sdk\tools;C:\phonegap_project\adt-bundle-windows-x86_64-20131030\sdk\build-tools;C:\Program Files\Java\jdk1.8.0_05\bin;
if Not Run JVM
Set systems variables
Click New
variable Name:_JAVA_OPTIONS
variable value:-Xmx512M
I'm trying to add the android platform however this is the error message I keep getting
C:\Users\Xavier\Desktop\Mtek_DM\Mtek>cordova -d platform add android
cordova library for "android" already exists. No need to download.
Continuing. Checking if platform "android" passes minimum
requirements... Creating android project... Running command:
C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\create.b at
--cli C:\Users\Xavier\Desktop\Mtek_DM\Mtek\platforms\android org.xtek.Mtek Mt ek
C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.js:126
throw e;
^ Error: An error occurred while listing Android targets
at C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\lib\check_reqs.js:
87:29
at _rejected (C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\node_mo
dules\q\q.js:808:24)
at C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.j
s:834:30
at Promise.when (C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\node
_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\Xavier.cordova\lib\android\cor
dova\3.5.1\bin\node_modules\q\q.js:752:41)
at C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\node_modules\q\q.j
s:574:44
at flush (C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\node_module
s\q\q.js:108:17)
at process._tickCallback (node.js:415:13) Command finished with error code 8: C:\Users\Xavier.cordova\lib\android\cordova
\3.5.1\bin\create.bat
--cli,C:\Users\Xavier\Desktop\Mtek_DM\Mtek\platforms\andro id,org.xtek.Mtek,Mtek Error:
C:\Users\Xavier.cordova\lib\android\cordova\3.5.1\bin\create.bat:
Comman d failed with exit code 8
at ChildProcess.whenDone (C:\Users\Xavier\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.js:135: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)
Furthermore, I created my System environments at
ANDROID_HOME =C:\Users\Xavier\Desktop\Android\sdk\platform-tools
ANT_HOME = C:\Users\Xavier\Desktop\Android\apache_ant1.9.4 JAVA_HOME =
C:\Program Files\Java\jdk1.7.0_21
And linked them under my variable PATH as
C:\Users\Xavier\AppData\Roaming\npm;%ANT_HOME%/bin;%ANDROID_HOME%/tools;%ANDROID_HOME%/platform-tools;%JAVA_HOME%/bin
Am I missing something? because when I typein java in the command line it works but for ant i get "buildfile: build.xml does not exist! build fail"
ANDROID_HOME should point to \sdk, not \sdk\platform-tools\. This is because the build system uses things in both platform-tools and tools folders. Change that and try again in a new terminal window please.
D:\Shabbir\AndroidTest>cordova platform add android
Creating android project...
C:\Documents and Settings\avaya11\Application Data\npm\node_modules\cordova\node
_modules\q\q.js:126
throw e;
^
Error: An error occured during creation of android sub-project.
C:\Documents and Settings\avaya11\.cordova\lib\android\cordova\3.3.0\bin\node_mo
dules\q\q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at C:\Documents and Settings\avaya11\.cordova\lib\android\cordova\3.3.0\bin\
lib\check_reqs.js:87:29
at _rejected (C:\Documents and Settings\avaya11\.cordova\lib\android\cordova
\3.3.0\bin\node_modules\q\q.js:808:24)
at C:\Documents and Settings\avaya11\.cordova\lib\android\cordova\3.3.0\bin\
node_modules\q\q.js:834:30
at Promise.when (C:\Documents and Settings\avaya11\.cordova\lib\android\cord
ova\3.3.0\bin\node_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Documents and Settings\avaya11\.cordo
va\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:752:41)
at C:\Documents and Settings\avaya11\.cordova\lib\android\cordova\3.3.0\bin\
node_modules\q\q.js:574:44
at flush (C:\Documents and Settings\avaya11\.cordova\lib\android\cordova\3.3
.0\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:415:13)
at C:\Documents and Settings\avaya11\Application Data\npm\node_modules\cordo
va\src\platform.js:244:30
at ChildProcess.exithandler (child_process.js:641:7)
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)
D:\Shabbir\AndroidTest>
This Error I got
I downloaded NodeJS and install Following
npm -g install phonegap
npm -g install cordova
npm -g install plugman
npm -g install ant
I set some path for that
PATH
C:\Documents and Settings\avaya11\Application Data\npm;C:\Documents and Settings\avaya11\Application Data\npm\node_modules\ant;C:\NEW ANDROID\sdk\platforms;C:\NEW ANDROID\sdk\platform-tools;C:\Documents and Settings\avaya11\Application Data\npm\node_modules\ant\bin;C:\Program Files\Java\jdk1.6.0_45\bin
this is ANT_HOME path that i downloaded from here
ANT_HOME
C:\Program Files\Java\apache-ant-1.9.3
also added JAVA_HOME , ANDROID_HOME
I did all possible ways but still found error PLZ help me to find solution
I think I confused to set a path.
After so much research work I found the answer.
I have not set path of the xcopy.
xcopy.exe - this file contains sdk platform information. So I added path of this. xcopy.exe is located in system32 folder.
So I added path like this and I able to add android platform.
%SystemRoot%\System32;
this path issues
Click on the Start menu in the lower-left corner of the desktop, right-click on Computer, then click Properties.
Click Advanced System Settings in the column on the left.
In the resulting dialog box, press Environment Variables.
Select the PATH variable and press Edit.
Append the following to the PATH based on where you installed the SDK, for example
C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools
refer
here for windows
I tried to add the android platform by:
$ cordova platform add android
I get that out:
Creating android project...
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occured during creation of android sub-project.
/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:126
throw e;
^
Error: The command "android" failed. Make sure you have the latest Android SDK installed, and the "android" command (inside the tools/ folder) is added to your path.
at /Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/lib/check_reqs.js:85:29
at _rejected (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:808:24)
at /Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:834:30
at Promise.when (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:752:41)
at /Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:574:44
at flush (/Users/jannisportmann/.cordova/lib/android/cordova/3.3.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
at /usr/local/lib/node_modules/cordova/src/platform.js:244:30
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
I specified the SDK's path in the .bash_profile, is there something more I need to do?
Thanks for answers!
I fixed it!! First you have to add android tools and platform tools to your PATH...
So open your user profile ( in terminal type:)
nano ~/.profile
PATH=$PATH:/YOUR_ADT_FOLDER/sdk/platform-tools:/YOUR_ADT_FOLDER/sdk/tools
export PATH
Save it and type on terminal:
. ~/.profile
Now try to add your cordova platform, if it not works try to install apache ant. I'm using elementary os, so I opened the software center, searched for ant e install it. After it see if 'ant' is on your terminal and then add your platform.
For OSX your path needs to include /Users/yourusername
their example: /Development/adt-bundle/sdk/platform-tools
needs to be: /Users/yourusername/Development/adt-bundle/sdk/platform-tools
check your path with echo $PATH (use caps, it's case sensitive!)
this is documentation Phonegab docs for setup .bash_profile(mac),bashrc(linux), or windows
and my .bash_profile:
export PATH=${PATH}:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/platform-tools:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/tools
visit the solution here
I hope this helps you
Try,
cordova platform add android