Cordova Android Build - android

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

Related

ENOENT, no such file or directory - on building Android Cordova Project

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.

Apache cordova add platform android error

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

how to create project in ionic,cordova and android?

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.

Cannot add Android Platform in Phonegap

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.

Cordova Platform add android issues

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.

Categories

Resources