I have meteor project and I try to start it on my mobile device. It starts successfully if I run project on my windows pc and I'm getting this error(error in title) when I try to start it in my linux(ubuntu) pc. Did everything from mobile tutorial on official site of meteor and still can't start a project. I saw a lot of almost the same questions but they hadn't correct answers for me.
Try run your this command in your terminal:
echo $ANDROID_HOME
it should return something like this
/home/ivan133/Android/Sdk
If it returns empty string execute these commands and build again
export ANDROID_HOME=${HOME}/Android/Sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
Next, it would be nice to add it to your ./bashrc (if you're using bash)
Just open ~/.bashrc with text editor and copy the strings to the end
I had followed the above instructions to no avail. Realized the /tools folder was somehow missing from the /sdk folder. Also it's sdk not Sdk for me.
Complete instructions:
Double check where your sdk folder is. Should be something like:
/User/example-user/Library/Android/sdk
Visit https://developer.android.com/studio?pkg=tools and download the SDK tools package
Extract the contents of that. Should result in a directory named tools
run open /User/example-user/Library/Android/sdk
Place the tools folder into /sdk (so just to be clear, it will be at /User/example-user/Library/Android/sdk/tools
You can then do the following:
export ANDROID_HOME=${HOME}/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
meteor remove-platform android
meteor add-platform android
To check the environment variables first
env
If env variable not available means open or create .zprofile or .zshrc file in your HOME folder.
touch ~/.zprofile; open ~/.zprofile
or
touch ~/.zshrc; open ~/.zshrc
Added these lines
export ANDROID_HOME=${HOME}/Library/Android/sdk
export ANDROID_SDK_ROOT=${HOME}/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
After added that variable and run this below comment
source ~/.zprofile
or
source ~/.zshrc
and it started to work
Now again to verify to type comment line
env
Check the env variable availability
I added these lines
export ANDROID_HOME=${HOME}/Android/Sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
to ~/.zshrc file
and it started to work
I try to set ANDROID_HOME in bash, I use CentOs 7.
First, try to export with
export ANDROID_HOME=/home/zhilevan/Android/Sdk
Then
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
and w hen I type $ android it added correctly.
Problem is: when I close terminal and then type android faced with bash: android: command not found...
In another effort, in last step I type source .bashrc but the result is the same "after closing the terminal android :command not found".
where is the problem,why it not work?
It does not work because when you open a new terminal, the exports no longer exist in the new shell. You need to add them to the ~/.bashrc file which is loaded when opening a new terminal.
Add these two exports in ~/.bashrc:
export ANDROID_HOME=/home/zhilevan/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
You can run the following command to add them from terminal:
echo '
export ANDROID_HOME=/home/zhilevan/Android/Sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
' >> ~/.bashrc
Then source the ~/.bashrc (or open a new terminal)
source ~/.bashrc
I am trying to setup android linphone project on Window and most of the things I have done. I set environment variable path(system and user) and export path in .bashrc and .bash_profile file which is located in cygwin home directory.
export PATH=${PATH}:/D:/android-sdk/tools
export PATH=${PATH}:/D:/android-sdk/platform-tools
export PATH=${PATH}:/D:/android-sdk/ndk-bundle
export PATH=${PATH}:/D:/android-sdk
export PATH=${PATH}:/C:/apache-ant-1.9.6-bin/apache-ant-1.9.6/bin
export PATH=${PATH}:/D:/android-sdk/android-ndk-r10e
Now when I am running make command on cygwin command prompt in android Linphone directory than I am getting this error: "Could not find android. Please install android SDK."
How can I resolve this issue?
Please note that : is both the linux path delimiter and the windows drive indicator. Your
export PATH=${PATH}:/D:/android-sdk/tools
adds two directories to the path, /D and /android-sdk/tools.
Try /cygdrive/d/ instead of /D:.
How to set ANDROID_HOME path in ubuntu?
Please provide the steps.
In the console just type these :
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
If you want to make it permanent just add those lines in the ~/.bashrc file
I would like to share an answer that also demonstrates approach using the Android SDK provided by the Ubuntu repository:
Install Android SDK
sudo apt-get install android-sdk
Export environmental variables
export ANDROID_HOME="/usr/lib/android-sdk/"
export PATH="${PATH}:${ANDROID_HOME}tools/:${ANDROID_HOME}platform-tools/"
Assuming you have the sdk extracted at ~/Android/Sdk,
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
Add the above lines to the file ~/.bashrc (located at home/username/.bashrc) to make it permanent for the current user. Run source ~/.bashrc to apply the changes or restart your terminal.
(or)
Run the above lines on a terminal window to make it available for the session.
To test if you have set it up correctly,
Run the below commands on a terminal window
echo $ANDROID_HOME
user#host:~$ echo $ANDROID_HOME
/home/<user>/Android/Sdk
which android
user#host:~$ which android
/home/<user>/Android/Sdk/tools/android
Run android on a terminal window, If it opens up Android SDK Manager, you are good to go.
better way is to reuse ANDROID_HOME variable in path variable. if your ANDROID_HOME variable changes you just have to make change at one place.
export ANDROID_HOME=/home/arshid/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Initially go to your home and press Ctrl + H it will show you hidden files now look for .bashrc file, open it with any text editor then place below lines at the end of file.
export ANDROID_HOME=/home/varun/Android/Sdk
export PATH=$PATH:/home/varun/Android/Sdk/tools
export PATH=$PATH:/home/varun/Android/Sdk/platform-tools
Please change /home/varun/Android/Sdk path to your SDK path.
Do the same for tools and platform-tools.
After this save .bashrc file and close it.
Now you are ready to use ADB commands on terminal.
Add the following to your ~/.bashrc file. Log-out and log-in. I have my sdk in $HOME/Documents/Android/sdk you have to replace it with where you keep your sdk folder
# Android Path
PATH=$PATH:$HOME/Documents/Android/sdk:$HOME/Documents/Android/sdk/tools
export PATH
# For SDK version r_08 and higher, also add this for adb:
PATH=$PATH:$HOME/Documents/Android/sdk/platform-tools
export PATH
first open the .bashrc file by gedit ~/.bashrc
# Added ANDROID_HOME variable.
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
save the file and reopen the terminal
echo $ANDROID_HOME
it will show the path like /home/pathTo/Android/Sdk
Applies to Ubuntu and Linux Mint
In the archive:
sudo nano .bashrc
Add to the end:
export ANDROID_HOME=${HOME}/Android/Sdk
export PATH=${PATH}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools
Restart the terminal and doing: echo $ HOME or $ PATH, you can know these variables.
Download the Android SDK to the machine. (Suppose that the location is /home/zelong/Android/Sdk) (home/username/Android/Sdk)
Add these lines to the file ~/.bashrc (located at home/username/.bashrc)
export ANDROID_HOME="/home/zelong/Android/Sdk"
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
This will make it permanent for the current user because every time the machine boots, it will run this script and set the enviroment path.
After making this change, remember to save it.
Then run source ~/.bashrc to apply the changes or restart your terminal.
Test if it works:
zelong#zelong-ThinkPad-T430:~$ echo $ANDROID_HOME
/home/zelong/Android/Sdk
zelong#zelong-ThinkPad-T430:~$ which android
/home/zelong/Android/Sdk/tools/android
zelong#zelong-ThinkPad-T430:~$ which adb
/home/zelong/Android/Sdk/platform-tools/adb
As we can see,
android command line locates under tools
adb command line locates under platform-tools
This is what work for me,
Assuming you have the sdk extracted at ~/Android/Sdk,
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
Add the above lines to the file ~/.bashrc (located at home/username/.bashrc) to make it permanent for the current user. Run source ~/.bashrc to apply the changes or restart your terminal.
(or)
Run the above lines on a terminal window to make it available for the session.
To test if you have set it up correctly,
Run the below commands on a terminal window
echo $ANDROID_HOME
user#host:~$ echo $ANDROID_HOME
You will get
/home/<user>/Android/Sdk
You can run this too
which android
user#host:~$ which android
/home/<user>/Android/Sdk/tools/android
Run android on a terminal, If it opens up Android SDK Manager, you are good to go.
you can edit the environment variable file in Ubuntu to set android home globally.
[1] run this command in terminal
sudo -H gedit /etc/environment
[2] your envirmnent file content will look like the below one
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
[3] in environment file add android sdk path as follows:-
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
ANDROID_HOME="/home/yourPathTo/Android/Sdk"
[4] then you can check the Android home path in the terminal with the following command:-
echo $ANDROID_HOME
If path is still not set then restart the system to get the applied changes.
In my case it works with a little change. Simply by putting :$PATH at the end.
# andorid paths
export ANDROID_HOME=$HOME/Android/Sdk
export PATH="$ANDROID_HOME/tools:$PATH"
export PATH="$ANDROID_HOME/platform-tools:$PATH"
export PATH="$ANDROID_HOME/emulator:$PATH"
In the terminal just type these 3 commands to set the ANDROID_HOME Variable :
$ export ANDROID_HOME=~/Android/Sdk
/Android/Sdk is the location of Sdk, this might get change in your case
$ PATH=$PATH:$ANDROID_HOME/tools
$ PATH=$PATH:$ANDROID_HOME/platform-tools `
Note : This will set the path temporarily so what ever action
you have to perform, perform on the same terminal.
If you run android with sudo it will install sdk in /root/Android/Sdk
so check if that is the case.
And if you are using dont run cordova with sudo it will look sdk in root also may be.
Above code for setting path is works fine.
I was facing the same problem with linux ANDROID_HOME path
Note:
1- Add parameters
2- Make or Rebuild project
3- Restart your PC
How to add parameters using terminal:
Open your terminal write
gedit .bashrc
another window will be open and then add the following lines at the end of the windows.
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
then back to terminal and type
source .bashrc
to save your changes in bashrc file at the end restart your computer.
add to file
~/.profile
export ANDROID_HOME=/opt/android-sdk
Path to the SDK
Then reset the computer
Had the same issue,
in the terminal you can type:
export ANDROID_HOME=$HOME/Android/Sdk
or any other location depending on where you installed the sdk.
export PATH=$PATH:$ANDROID_HOME/platform-tools
Hope it helps!
sudo su -
gedit ~/.bashrc
export PATH=${PATH}:/your path
export PATH=${PATH}:/your path
export PATH=${PATH}:/opt/workspace/android/android-sdk-linux/tools
export PATH=${PATH}:/opt/workspace/android/android-sdk-linux/platform-tools
You can append this line at the end of .bashrc file-
export PATH=$PATH:"/opt/Android/Sdk/platform-tools/"
here /opt/Android/Sdk/platform-tools/ is installation directory of Sdk.
.bashrc file is located in home folder
vi ~/.bashrc
or if you have sublime installed
subl ~/.bashrc
open ~/.bashrc file and paste at the end
export PATH=$PATH{}:/path-from-home-dir/android/sdk/tools
export PATH=$PATH{}:/path-from-home-dir/android/sdk/platform-tools
I tried to make a .jar file from a cloned project:
android update project -p .
but got the error:
android: command not found
I tried to set path to Android SDK, but it didn't help:
export ANDROID_HOME=D:\java\android-sdk
export PATH=$ANDROID_HOME\tools:$PATH
export PATH=$ANDROID_HOME\platform-tools:$PATH
Is it possible to solve this problem?
UPD:
I'm using Git Shell from this software: http://git-scm.com/download/win
Finding-android-sdk-on-mac-and-adding-to-path
Finding Android SDK on Mac and adding to PATH
To fix
android: command not found error
follow two easy steps (Linux and Mac):
1) Export your Android Sdk path to the ANDROID_HOME variable
$ export ANDROID_HOME=~/Android/Sdk
(change "~" to "$HOME" on Mac)
2) Export Sdk tools path to the PATH variable
$ export PATH=$ANDROID_HOME/tools:$PATH
That's it! run
android
command again to make sure it works properly.
You have to configure ANDROID_HOME environment variable.
For Mac Run this command
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
For Windows
Go to Control Panel → System and Security → System → Change settings → Advanced System Settings → Environment variables → New, then enter the path to your Android SDK.
Variable name = ANDROID_HOME
Variable path = your android sdk path.
If you run commands from windows shell (cmd.exe) you should add D:\java\android-sdk\tools and D:\java\android-sdk\platform-tools to your path via computer properties dialog.
If you run on Cygwin try export PATH=/cygdrive/d/java/android-sdk/tools:/cygdrive/d/java/android-sdk/platform-tools:${PATH}.
This worked for me on ubuntu
Edit the bashrc using nano:
nano ~/.bashrc
By adding the following to the end of the file:
export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
Exiting the nano editor:
ctrl + x , then type Y, then hit the enter key to save the changes to the .basrc file and to exit the nano editor.
The above steps would ensure that your changes remains after the terminal closes. Note, for the android command to work ensure to close the terminal and reopen a new one.