ANDROID_HOME is not set (Ubuntu 16.04) - android

I have followed all steps mentioned from here
I have set ANDROID_HOME and set PATH in bashrc file.
export ANDROID_HOME=/home/sanjay/Android/Sdk
export PATH=$PATH:/home/sanjay/Android/Sdk/tools
export PATH=$PATH:/home/sanjay/Android/Sdk/platform-tools
But still the error "environment variable is not set", "It should be set to SDK home directory" pops up every time I try to build an app.
Please help to resolve this issue..

Remove the spaces betwen the path and ANDROID_HOME in this line:
export ANDROID_HOME = /home/sanjay/Android/Sdk
such that it reads:
export ANDROID_HOME=/home/sanjay/Android/Sdk

It is not that difficult but you got to make your project make know weatabouts of your SDK.
Try following in your terminal
temporary option: In terminal root of your project
export ANDROID_HOME=[sdk location]
gradle build
===================================
adding path permanent:
Linux - ~/.bashrrc
export ANDROID_HOME=[sdd location]
export PATH=$ANDROID_HOME:$PATH

Related

React-Native : Setting up Android emulator, JAVA_HOME is set to an invalid directory

I get this error. (I know this might not be React native specific and i also tried other solutions i still don't come right.)
ERROR: JAVA_HOME is set to an invalid directory: ”/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home”
I just installed jdk 8, This is how i did the export.
export JAVA_HOME=”$(/usr/libexec/java_home -v 1.8)”
And added to ~/.profile
vi ~/.profile, //then added : export JAVA_HOME=”$(/usr/libexec/java_home -v 1.8)”
Below is the error i get whe i run react-native run-android
What do you get when you execute which java from your command line?
On my machine I get /Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home/bin/java
and it is because I have exported my JAVA HOME as follows:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home
and then I have :
export PATH=$JAVA_HOME/bin:${PATH} to make sure that this JAVA_HOME is set before the system's.

Ubuntu / Elementary OS cannot set ANDROID_HOME

I'm facing the problem, that i cannot set the ANDROID_HOME path variable.
I added the following lines to my bashrc file:
# Android Path
export ANDROID_HOME=~/android-sdk/Sdk/tools
But when i try to access android via the terminal i get this error:
android: command not found
How can i solve this problem?
You need to add the variable in your PATH as well. The aim is for your PATH variable to contain the complete folder path, in which the file 'android' is present.
export ANDROID_HOME=~/android-sdk/Sdk/tools
export PATH=$ANDROID_HOME:$PATH
Don't forget to source your bashrc after adding these lines
source ~/.bashrc
Again, the file 'android' should be present in the tools folder.
Follow the following steps:
1)Open the bashrc file from command line
nano ~/.bashrc
2) Add following lines at the top.
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
3)Now, quit terminal and re-launch, and try typing:
adb -h
android -h
If both commands are giving you output, it means everything works fine.

PhoneGap - Cordova build android faild

I'm new in phonegap. I have this problem when I try to build with cordova :
sudo cordova build android
Here is the log :
Running command: /home/paul/Documents/Projets/tozer0-app/platforms/android/cordova/build
[Error: Failed to find 'JAVA_HOME' environment variable. Try setting setting it manually.]
ERROR building one of the platforms: Error: /home/paul/Documents/Projets/tozer0-app/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/paul/Documents/Projets/tozer0-app/platforms/android/cordova/build: Command failed with exit code 2
Any idea ?
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:
export ANDROID_HOME=/path/to/android/SDK
export PATH=$PATH:$ANDROID_HOME/bin
you can do the same for Ant.
For java jdk
add this into your /etc/profile file:
JAVA_HOME=/path/to/jdk
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
Now in your terminal, type echo $PATH and make sure all the environment variables are added to the PATH!

Setting PATH ubuntu 14.04

I have obstacle when run sudo ionc build android.
Error log terminal:
Set enviroment varibale in .profile:
Please give me solutions. How to setting PATH that true.
The system is not able to find the environment variable ANDROID_HOME in your .bashrc file. To resolve this error, you need to add the following to line to your ~/.bashrc file:
export ANDROID_HOME="<path/to/your/sdk/without/quotes>"
For me, I added the following
export ANDROID_HOME="/Users/chi6rag/Library/Android/sdk"
And ran source ~/.bashrc so that the configuration is loaded.

[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"

Categories

Resources