I have installed ionic, cordova and android.
But ionic is not creating android project.
I have attached the error.
C:\Users\shri\myapp>ionic platform add android
Creating android project...
C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\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 C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\lib\check_reqs.js:158:19
at _fulfilled (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:760:13)
at C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:821:14
at flush (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:906:3
Error: C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\create.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\shri\AppData\Roaming\npm\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)
You need to include ANDROID_HOME in your PATH. I recommend you do the following (assuming you're on Windows 8.1):
Right click the tile launcher icon in your task bar and choose system. In the window that pops up, choose Advanced system settings on the left. In the System Properties window click the Environment Variables button and choose to add a new system variable. For the name choose ANDROID_HOME and for the value include the full path to your Android SDK directory.
Edit the PATH variable and add the following to the end of the value:
;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
Restart your windows session and it should work now.
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 attempting to use the emulator via Phonegap, upon following these instructions in order to build the app. It fist tells me that I dont have Android installed as a platform, but I do have the Android sdk, of which I then made sure that the path was correct following these instructions, .
I then attempt to check platforms, and receive error that no platforms installed.
I then skipped to building the app, just to see what would happen, and receive this:
C:\Users\Jessica.PORTER\hello>cordova platform add android
Creating android project...
C:\Users\Jessica.PORTER\.cordova\lib\npm_cache\cordova-android\3.6.4
\node_modules\q\q.js:126
throw e;
^
Error: ANDROID_HOME is not set and "android" command not in your PAT
fulfill at least one of these conditions.
at C:\Users\Jessica.PORTER\.cordova\lib\npm_cache\cordova-androi
age\bin\lib\check_reqs.js:159:19
at _fulfilled (C:\Users\Jessica.PORTER\.cordova\lib\npm_cache\co
d\3.6.4\package\bin\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (C:\Users\Jessica.PORTER\.cordova\l
\cordova-android\3.6.4\package\bin\node_modules\q\q.js:827:30)
at Promise.promise.promiseDispatch (C:\Users\Jessica.PORTER\.cor
_cache\cordova-android\3.6.4\package\bin\node_modules\q\q.js:760:13)
at C:\Users\Jessica.PORTER\.cordova\lib\npm_cache\cordova-androi
age\bin\node_modules\q\q.js:821:14
at flush (C:\Users\Jessica.PORTER\.cordova\lib\npm_cache\cordova
.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: C:\Users\Jessica.PORTER\.cordova\lib\npm_cache\cordova-androi
age\bin\create.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Jessica.PORTER\AppData\Roamin
odules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:13
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
As you can still see from
Error: ANDROID_HOME is not set and "android" command not in your PATH
It clearly tells you that you haven't set the ANDROID_HOME and that the android command isn't found from your PATH. To fix it, locate the Android SDK installation location and at it to the PATH. Also, open new command line instance after adding them since they are only loaded at the boot-time of command line.
You can also check if the android command is correctly added to PATH by opening the command line and simply typing android. If it tells you something like no such program, it means that it isn't still available.
Changing ANdroid Home -
I fixed the problem by adding a new Environment Variable named ANDROID_SDK_HOME and then linked it to Android folder C:\Program Files (x86)\Android
Thank you for all your help!!!!
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.
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.
with the help of the phonegap docs( http://cordova.apache.org/docs/en/3.5.0//guide_cli_index.md.html), i installed node.js, git client and cordova 3.5.0 successfully.
And also i am able to install windows8 and wp8.
But when installing android, i am getting the following error:
C:\Users\rajkiranb\hello>cordova platform add android
Creating android project...
C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:12
6
throw e;
^
Error: An error occurred while listing Android targets
at C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.
js:87:29
at _rejected (C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\node
_modules\q\q.js:808:24)
at C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\
q.js:834:30
at Promise.when (C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\n
ode_modules\q\q.js:1079:31)
at Promise.promise.promiseDispatch (C:\Users\rajkiranb\.cordova\lib\android\
cordova\3.5.0\bin\node_modules\q\q.js:752:41)
at C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\
q.js:574:44
at flush (C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\node_mod
ules\q\q.js:108:17)
at process._tickCallback (node.js:419:13)
Error: C:\Users\rajkiranb\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Com
mand failed with exit code 8
at ChildProcess.whenDone (C:\Users\rajkiranb\AppData\Roaming\npm\node_module
s\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)
In Computer -> C -> Environment variables..
In user variables and system variables, i added ANT.
ANT_HOME = C:\Program Files (x86)\WinAnt
But no luck.
Please help me out.
Add this directly to your path varible
C:\Users\rajkiranb\android\adt-bundle-windows-x86_64-20140321\sdk\platform-tools;C:\Users\rajkiranb\android\adt-bundle-windows-x86_64-20140321\sdk\tools
See the second one is tools not build-tools
Check whether you have ANDROID_HOME system variable set to android sdk location