How can I set the 'ANDROID_HOME' environment variable? - android

I am done with my requirements and I am unable to build my app. It is simply throwing an error like:
Error: Failed to find 'ANDROID_HOME' environment variable.
Try setting setting it manually.
Failed to find 'android' command in your 'PATH'.
Try update your 'PATH' to include path to valid SDK directory.
Can anyone suggest me how to rectify?

Include the below lines in .bash_profile file:
export ANDROID_HOME=/YOUR_PATH_TO/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=/usr/local/bin:$PATH

Related

Error: Failed to find 'ANDROID_HOME' environment variable. Failed to find 'android' command in your 'PATH'

I've an error in ionic when I try to build android!
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting
setting it manually. Failed to find 'android' command in your 'PATH'.
Try update your 'PATH' to include path to valid SDK directory.
but:
➜ echo $ANDROID_HOME
/home/amaitre/android-sdk-linux
and the command android work:
http://hpics.li/b1c351a
Be careful if you sudo your ionic command !
Don't forget to add the path in your super user environment :)
Download Android SDK Tools from http://developer.android.com/sdk/installing/index.html?pkg=tools
Extract in: /home/{{user}}/build/
Insert below code at ~/.profile (caution: do not remove anything from there, just append this code)
//set PATH so it includes android SDK toold
if [ -d "$HOME/build" ] ; then
ANDROID_HOME=$HOME/build/android-sdk
PATH="ANDROID_HOME/tools:$PATH"
fi
Please let me know if this suggestion solved your problem.

Windows cordova build error: Failed to find 'ANDROID_HOME' environment variable

OS: Windows 7.
I have created a project in cordova, but when I try to build it with the command cordova build android, it returns an error which says:
ERROR building one of the platforms: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
You may not have the required environment or OS to build this project
Error: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
at C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\lib\check_reqs.js:223:19
at _fulfilled (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:796:13)
at C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:857:14
at runSingle (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (C:\Users\Ahmed\Desktop\nodejs\hello\platforms\android\cordova\node_modules\q\q.js:125:13)
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
at Function.Module.runMain (module.js:449:11)
I've already set up a variable named ANDROID_HOME in the user environment variables with the path to my android sdk: E:\android\sdk. Still i'm getting this error.
Your path is not OK, you have to reference
E:\android\sdk\tools
E:\android\sdk\platform-tools
Into the Path variable
For checking if this is correctly installed, just enter android in your console, and check if there are no errors
Had the same issue, fixed it by renaming a folder called "Fastboot" in my C:/ drive's root.

Ionic Lab with android intallation

Basically i am working in Ubuntu.I created my application and set the platform android but i am getting
** ERROR**
Command failed with exit code 2 Error output: { [CordovaError: Failed
to find 'ANDROID_HOME' environment variable. Try setting setting it
manually. Failed to find 'android' command in your 'PATH'. Try update
your 'PATH' to include path to valid SDK directory.] name:
'CordovaError', message: 'Failed to find \'ANDROID_HOME\' environment
variable. Try setting setting it manually.\nFailed to find \'android\'
command in your \'PATH\'. Try update your \'PATH\' to include path to
valid SDK directory.', code: 0, context: undefined
As error suggests path is not defined properly for ANDROID_HOME.
In the console(use your current location)
export ANDROID_HOME=/home/abc/Android/Sdk
export PATH=$PATH:/home/abc/Android/Sdk/tools
If want it to make it permanent add those lines in the ~/.bashrc file using nano or any editor.

[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually

Im using Cordova in Linux mint 17
I installed android sdk , cordova , android studio , nodejs 4
problem is here
when i wanna build app in codova and run this on terminal :
sudo cordova build android
it shows
Running command: /home/tnt/hello12/platforms/android/cordova/build
[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.]
ERROR building one of the platforms: Error: /home/tnt/hello12/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/tnt/hello12/platforms/android/cordova/build: Command failed with exit code 2
I put this code
export HOME="/home/tnt"
export ANDROID_HOME="$HOME/android/sdk/tools"
export ANDROID_PLATFORM_TOOLS="$HOME/android/sdk/platform-tools"
export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
export ANT_HOME="/usr/share/ant"
export PATH="$ANT_HOME/bin:$PATH"
export ANDROID_HOME="/home/tnt/android/sdk/tools"
on my
/home/tnt/.bash_profile
/home/tnt/.bashrc
/home/tnt/.profile
/root/.bash_profile
/root/.bashrc
/root/.profile
but it wont works
I don't think its necessary to add everything into path.Just add the JAVA_HOME , ANDROID_HOME and ANT_HOME to path and point out the corresponding bin directory as:
For android studio
add this into your ~/.bashrc file:
1.export ANDROID_HOME=/path/to/android/studio
2.export PATH=$PATH:$ANDROID_HOME/bin
you can do the same for Ant.
For java jdk
add this into your /etc/profile file:
1.JAVA_HOME=/path/to/jdk
2.JRE_HOME=$JAVA_HOME/jre
3.PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
4.export JAVA_HOME
5.export JRE_HOME
6.export PATH
Now in your terminal, type echo $PATH and make sure all the environment variables are added to the PATH!
You should edit /etc/sudoers with
sudo visudo
At the end of the file enter:
Defaults env_keep +="ANDROID_HOME"

Ionic AngularJS build android on ubuntu

I created mobile application with Ionic. I want build application and I've a problem, I try build application on Vagrant but I get response error.
ERROR: Error: Failed to find 'ANDROID_HOME' environment variable. Try
setting setting it manually. Failed to find 'android' command in your
'PATH'. Try update your 'PATH' to include path to valid SDK directory
My .profile:
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"
ANDROID_HOME=/opt/android-sdk-linux
ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform-tools
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/u$
ANDROID_SDK=/opt/android-sdk-linux
How fix? Any ideas?
I think you may try this
export ANDROID_HOME=/installation-location/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Look to the source for more details

Categories

Resources