Home » Android » android – How to set ANDROID_HOME path in ubuntu?

android – How to set ANDROID_HOME path in ubuntu?

Posted by: admin March 10, 2020 Leave a comment

Questions:

How to set ANDROID_HOME path in ubuntu?

Please provide the steps.

How to&Answers:

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

Answer:

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

Answer:

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
  1. 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)

  2. 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

  1. echo $ANDROID_HOME

    [email protected]:~$ echo $ANDROID_HOME
    /home/<user>/Android/Sdk
    
  2. which android

    [email protected]:~$ which android
    /home/<user>/Android/Sdk/tools/android
    
  3. Run android on a terminal window, If it opens up Android SDK Manager, you are good to go.

Answer:

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

Answer:

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

Answer:

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.

Answer:

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

Answer:

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.

Answer:

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.

Answer:

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.

Answer:

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.

Answer:

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

Answer:

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

Answer:

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

Answer:

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 PC to get the applied changes.

Answer:

add to file

~/.profile 


export ANDROID_HOME=/opt/android-sdk

Path to the SDK

Then reset the computer