Seems that I can't get it right, or I'm doing it wrong
I'm using ubuntu/elementary OS
I added the paths to
tail ~/.bashrc
Gives me this
export HOME="/home/jsantana"
export ANDROID_HOME="$HOME/Downloads/android-studio/sdk"
export PATH="$PATH:/$ANDROID_HOME/tools:/$ANDROID_HOME/platform-tools"
echo $PATH
returns this
//home/jsantana/Downloads/android-studio/sdk/tools://home/jsantana/Downloads/android-studio/sdk/platform-tools
BUT when I run sudo phonegap run android on my testapp it returns this error
$ sudo phonegap run android
[phonegap] executing 'cordova run android'...
cp: no such file or directory: /home/jsantana/phonegap/testapp/icon.png
Running command: /home/jsantana/phonegap/testapp/platforms/android/cordova/run
ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Error: /home/jsantana/phonegap/testapp/platforms/android/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/lib/node_modules/phonegap/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)
Really not sure what I'm doing wrong here.
The paths are correct but still says they are incorrect
EDIT:
so I changed a bit but still get the same error:
export HOME="/home/jsantana"
export ANDROID_HOME="$HOME/Downloads/android-studio/sdk"
export PATH="${PATH}:/home/jsantana/Downloads/android-studio/sdk/platform-tools"
export PATH="${PATH}:/home/jsantana/Downloads/android-studio/sdk/tools"
when I $ echo $PATH
/home/jsantana/Downloads/android-studio/sdk/tools:/home/jsantana/Downloads/android-studio/sdk/platform-tools
getting same error
[phonegap] executing 'cordova run android'...
cp: no such file or directory: /home/jsantana/phonegap/testapp/icon.png
Running command: /home/jsantana/phonegap/testapp/platforms/android/cordova/run
ERROR: Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.
Error: /home/jsantana/phonegap/testapp/platforms/android/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/lib/node_modules/phonegap/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)
try like this one
export PATH=${PATH}:/home/jsantana/Downloads/android-studio/sdk/platform-tools
export PATH=${PATH}:/home/jsantana/Downloads/android-studio/sdk/tools
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 am not able to add platform to ionic its behaving weird
when i run sudo ionic platform add android
i get the following error
/home/user/.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/user/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/lib/check_reqs.js:159:19
at _fulfilled (/home/user/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/user/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/user/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:760:13)
at /home/user/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/node_modules/q/q.js:821:14
at flush (/home/user/.cordova/lib/npm_cache/cordova-android/3.6.4/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: /home/user/.cordova/lib/npm_cache/cordova-android/3.6.4/package/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/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)
but infact the $ANDROID_HOME has set properly also android command runs on terminal and opens up the SDK manage.
following is my environtment variables
:~/myApp$ echo $ANDROID_HOME
/home/user/android-sdks
:~/myApp$ echo $PATH
/home/user/android-sdks/tools/:/home/user/android-sdks/platform-tools/:/usr/local/ant/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-oracle/bin
You shouldn't use sudo for adding platforms, but anyway:
Before adding android Platform try with
export ANDROID_HOME=your/path/android/sdk
Today I started phonegap, as per documentation I am trying to setup my environment into my local machine.
In this process, I installed android SDK and set the environment variables in bashrc file.
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JAVA_HOME
PATH=$PATH:$JAVA_HOME
ANDROID_HOME=$HOME/Git/adt-bundle-linux/sdk
export ANDROID_HOME
PATH=$PATH:$ANDROID_HOME
ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
export ANDROID_PLATFORM_TOOLS
PATH=$PATH:$ANDROID_PLATFORM_TOOLS
ANDROID_TOOLS=$ANDROID_HOME/tools
export ANDROID_TOOLS
PATH=$PATH:$ANDROID_TOOLS
export PATH
ANT_HOME=/usr/share/ant
export ANT_HOME
PATH=$PATH:$ANT_HOME/bin
I switch to my working director and getting the following error after ran the cordova platform add android
Creating android project...
/home/.cordova/lib/npm_cache/cordova-
android/3.6.3/package/bin/node_modules/q/q.js:126
throw e;
^
Error: Failed to run "javac -version", make sure you have a Java JDK (not just a JRE) installed.
at /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:43:27
at ChildProcess.exithandler (child_process.js:651:7)
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)
Error: /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135: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)
#barrett:~/Git/phonegap/hellowPhonegap$
same command ran with "sudo" like sudo cordova platform add android, throwing the following error.
/home/.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 /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/lib/check_reqs.js:158:19
at _fulfilled (/home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:760:13)
at /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/node_modules/q/q.js:821:14
at flush (/home/.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: /home/.cordova/lib/npm_cache/cordova-android/3.6.3/package/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135: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 command shall I use later. If one of it,what's the problem.
can anyone help me.
I face the same problem let's do this javac -version then it show the available versions like
The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-4.8-jdk
* openjdk-7-jdk
* gcj-4.6-jdk
* openjdk-6-jdk
Try: sudo apt-get install <selected package>
fallow that.
I hope this is helps you.
i had same problem
add this to your path. in windows i did like this path=%path%;%android_home%/platform-tools
Add the path to ANDROID_HOME like this
export ANDROID_HOME='your path'
after check the path like echo $ANDROID_HOME
What happened to me was, that I had the openjre installed, but javac is actually part of the openjdk. Hope this helps someone.
I am creating an application in phonegap and I arrived at the stage of creating an android application, I try to install from the command line, I always receive this error here is an example of error, knowing that I have installed apache ant and I set their path in the path variable
C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
throw e;
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.5.0\bin\lib\check_reqs.js:47:27
at exithandler (child_process.js:633:7)
at ChildProcess.errorhandler (child_process.js:649:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:787:12)
Error: C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\user\AppData\Roaming\npm\node_modules\phonegap\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:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)
Follow these steps :
Download Ant from here
Uncompress the downloaded file into a directory.
Set environmental variables JAVA_HOME to your Java environment, ANT_HOME to the directory you uncompressed Ant to, and add ${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH.
Check Setup
Source link : Installing Apache Ant
Hope this helps.
when i try to add platform by this command cordova platform add android i got the below error
i search a lot and try every possible solution but could not fix this ANT error
please provide me some suggestion how do i fix it.
C:\Users\.cordova\lib\android\cordova\3.4.0\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\.cordova\lib\android\cordova\3.4.0\bin\lib\check_req s.js:47:27
at exithandler (child_process.js:633:7)
at ChildProcess.errorhandler (child_process.js:649:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:795:12) Error: C:\Users\.cordova\lib\android\cordova\3.4.0\bin\create.bat: C ommand failed with exit code 8
at ChildProcess.whenDone (C:\Users\AppData\Roaming\npm\node_modu les\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)
You need to install Apache ANT on your system and set the ant path in your system environment variables. Set the below options in the user variables.
ANT_HOME C:\apache-ant-1.8.2
Path ;C:\apache-ant-1.8.2\bin
Replace C:\apache-ant-1.8.2 with the ant installation path on your system. And you need add ;C:\apache-ant-1.8.2\bin to your path. Don't replace it.