Cordova missing ANDROID_HOME variable to emulate - android

How can I get the emulator working? Cordova missed the ANDROID_HOME environment variable, but it is set as the terminal output below shows
In NetBeans works only debug by using the browser of the device, but not the emulation of the app as APK
yves#dell-xps:~/NetBeansProjects/moTion$ sudo cordova emulate
[sudo] password for yves:
Running command: /home/yves/NetBeansProjects/moTion/platforms/android/cordova/run --emulator
ERROR: Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Error: /home/yves/NetBeansProjects/moTion/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:134: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)
yves#dell-xps:~/NetBeansProjects/moTion$ echo $ANDROID_HOME
/home/yves/Android/Sdk

Related

Keep getting: Failed to install 'cordova-plugin-whitelist':Error: cmd: Command failed with exit code 1

I'm new to this and I just wanted to do the things in this Tutorial:
Installing Cordova & Android SDK on Windows 7, 8 & 10 to Develop Mobile app
At 7:36 it's shown that I have to type:cordova platform add android
I did it but I'm getting this:
Failed to install 'cordova-plugin-whitelist':Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (G:\Cordovatest\hello\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:829:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: Error: cmd: Command failed with exit code 1
Hope to get some help-
please do the following:
1) Add the environment variables, ANDROID_HOME and JAVA_HOME ( giving the path of the folder Android SDK and the one of JDK in the value).
2) In the System Variable PATH, add the path of the platform-tools the one of the Tools folder.
It will fix your error successfully.
Case Ionic Solution plugin fail whitelisterror
invoking the location of the java_home executable ie java.exe then recompiling
reason: the environment variables did not load at that time fail windows, because if they were well declare, Thanks

Cordova - android error when building

This is my first experience in cordova. I created the helloworld project and installed the android platform correctly. When I tried to build the project by cordova build android, it shows this error message.
Running command: /home/menaka/hello/platforms/android/cordova/build
[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/menaka/hello/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/menaka/hello/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131: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)
But I have successfully set the ANDROID_HOME variable and PATH.
menaka#menaka-X550LC:~/hello$ echo $ANDROID_HOME
/Extra/Softwares/Android/Sdk/
So, what would be the reason for this?

Cordova build issue in ubuntu

I was following the tutorials # http://www.gaggl.com/2014/04/apache-cordova-development-environment-install-on-ubuntu/
Cordova build is failing with message:
:~/projects/Hello$ sudo cordova build
Running command: /home/skn/projects/Hello/platforms/android/cordova/build
[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/skn/projects/Hello/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/skn/projects/Hello/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131: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)
I have included the android in the path variable also.
skn#bangre:~/projects/Hello$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/bin/java:/usr/bin/ant:.:/home/skn/android-sdk-linux/tools:/home/skn/android-sdk-linux/platform-tools
From screenshot below you can see the sdk is installed
Also I have the following check which is passing.
skn#bangre:~/.cordova/lib/npm_cache/cordova-android/3.7.1/package/bin$ ./android_sdk_version
21
skn#bangre:~/.cordova/lib/npm_cache/cordova-android/3.7.1/package/bin$ ./check_reqs
Looks like your environment fully supports cordova-android development!
Please help me point out the issue.
yes turns out the cordova node.js scripts assumes the android sdk directory name as 'android-sdk' , for ubuntu when we unzip we get 'android-linux-sdk'

cordova build error on ubuntu when trying to build from terminal

I am getting the following error when trying to build sencha app in terminal on ubuntu meachine..
edge#edge-HP:~/Desktop/Anupam2014/MobileAtSite_Aug23/cordova$ cordova build
Running command: /home/edge/Desktop/Anupam2014/MobileAtSite_Aug23/cordova/platforms/android/cordova/build
Buildfile: /home/edge/Desktop/Anupam2014/MobileAtSite_Aug23/cordova/platforms/android/build.xml
BUILD FAILED
/home/edge/Desktop/Anupam2014/MobileAtSite_Aug23/cordova/platforms/android/build.xml:90: Cannot find
/home/transnoesis/Downloads/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml imported from
/home/edge/Desktop/Anupam2014/MobileAtSite_Aug23/cordova/platforms/android/build.xml
Total time: 0 seconds
Error code 1 for command: ant with args: debug,-
f,/home/edge/Desktop/Anupam2014/MobileAtSite_Aug23/cordova/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
Error: /home/edge/Desktop/Anupam2014/MobileAtSite_Aug23/cordova/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:126: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)
This looks path settings issue and is unable to find path to sdk & ant tools.
Currently I am on Windows and see how I've set paths on Windows, so you check and set yours accordingly on Ubuntu, hope will help you.
ANT_Home: C:\Program Files\apache-ant-1.9.4
Java_Home: C:\Program Files\Java\jdk1.7.0_60
ANDROID_HOME: C:\Android\AndroidSDK\sdk
path:.;C:\Program Files\nodejs\;%ANT_HOME%\bin;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;

Cordova can't add Android platform unknown command 'ant'

I'm trying to successfully install and create an app with cordova but it doesn't works.
So I've Googled and read many threads here on Stack Overflow but it hasn't helped.
Here's my problem:
If I try to add the Android platform via CMD with
cordova platform add android
I get the folowing error:
Error: ERROR : executing command 'ant', make sure you have ant installed and added
to your path.
at C:\Users\user\.cordova\lib\android\cordova\3.4.0\bin\lib
at ChildProcess.exithandler (child_process.js:641:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm
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've downloaded Apache ant and unzipped it into C:\ant.
My env vars are the following:
Path:
C:\Program Files\nodejs\;C:\dev\adt-bundle-windows-x86_64-20131030\sdk\platform-
tools;C:\dev\adt-bundle-windows-x86_64-20131030\sdk\tools;C:\Program
Files\Java\jdk1.7.0_40;C:\ant
(I tried c:\ant\bin and c:\ant)
JAVA_HOME:
C:\Program Files\Java\jdk1.7.0_40
ANT_HOME:
C:\ant
And it still isn't working. How can I fix this?
Use this one
Install ant using brew
Download and install Homebrew by executing following command in terminal:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Install Apache Ant via Homebrew by executing
brew install ant
Run the PhoneGap build again and it should successfully compile and install your Android app.
add C:\ant\bin; in your system path.
Then open cmd prompt. type ant -version if show like this. you will fix it.
ant -version
Apache Ant(TM) version 1.9.2 compiled on July 8 2013
if it's didn't resolve your problem then check your ant install path. May be C:\Program Files\ant\bin .then add it to your system path.
enjoy your code.

Categories

Resources