Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set ANDROID_HOME path in ubuntu?

Tags:

android

ubuntu

People also ask

HOW to set android HOME PATH in ubuntu?

For command-line tools, use tools/bin/sdkmanager ..." : therefore add (per above): export PATH=$PATH:$ANDROID_HOME/tools/bin then source ~/. profile (or . bashrc) if you don't want to logout.. then try running 'sdkmanager --licenses'. Then try compiling.

How do you verify ANDROID_HOME has been added?

If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used. If ANDROID_HOME is defined but does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT is used instead. Try echo $ANDROID_HOME . If that returns nothing try echo $ANDROID_SDK_ROOT .


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

    user@host:~$ echo $ANDROID_HOME
    /home/<user>/Android/Sdk
    
  2. which android

    user@host:~$ 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.


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